Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django migrations applied mid async celery process
I'm not sure this is the correct format for such a question, but worth a shot. Let's assume the following scenario: Django web application with multiple celery workers (running as docker images) Shared DB Once new code is deployed (with migrations applied) - if a worker is executing, it is allowed to finish the task (but no longer receiving any new workload) and then terminated; idle workers are terminated and recreated with new code The running worker is often out of sync with new DB schema - leading to task failures Question is: What would be the right approach to tackle this workflow? Letting running tasks finish is preferred since tasks may be long and painful to restart a couple of times a day... Any thoughts or existing resources would be appreciated. -
Django updates model instead of inserting when calling save()
Im trying to make a web app that has per user models. When logging in as a user with no current models it creates a new model for that user. The problem is that instead of inserting a new model it updates the existing model. The model has 3 fields, user, name and value. upon logging in the logic checks to see if there is model values with the users name in it and if there isn't then it creates a new model, or should. But currently it just updates all rows to associate them with the user that just logged in. This is my code for creation of a new model which is called when a user that has no model associated with it logs in and when a user wants to reset there model. #if there is no models associated with user/ recreate the model is called Board.object.filter(user=user).delete(); #create the new model for row in page_data.get("rows"): for name, value in row.items(): Board(user=user, name=name, value=value).save() -
Why is my Django project getting " An appropriate representation..." error?
I have a Django project where I'm trying to get a request and get data from it. When I do: request_text = 'http://asdfasdf.mx/api/rol/?blabla=2' r = requests.get(request_text) dict = json.loads(r.text) I get the An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security. error. If I access the request through my web browser, I see the results with no problem, however. I have used this code with many other requests, and I had never seen this error until today. -
The event popstate is not working in Google Chrome
I've been searching for a solution about the problem I've mentioned at the Title. Nevertheless I wasn't able to find a solution, so I decided to ask :) I don't why, but my code works perfectly fine in "Firefox", but when It comes to google, the "popstate" event is not working. There's a curious thing, though. If I paste directly the JS code that contains the "popstat", in the "Console" of Chrome. It f@***ng works. So, I don't know why this is happening. Below is my JS code: <!-- JAVASCRIPT PRINCIPAL (DEBE ESTAR CONTENIDO EN LA PÁG PRINCIPAL, COMO EN CUALQUIER PÁGINA HIJO). --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="/static/core/js/vendor/jquery-1.11.2.min.js"><\/script>')</script> <script src="/static/core/js/vendor/bootstrap.min.js"></script> <script src="/static/core/js/plugins.js"></script> <script src="/static/core/js/main.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { // navigation click actions $('.scroll-link').on('click', function(event){ event.preventDefault(); var sectionID = $(this).attr("data-id"); scrollToID('#' + sectionID, 750); }); // scroll to top action $('.scroll-top').on('click', function(event) { event.preventDefault(); $('html, body').animate({scrollTop:0}, 'slow'); }); // mobile nav toggle $('#nav-toggle').on('click', function (event) { event.preventDefault(); $('#main-nav').toggleClass("open"); }); }); // scroll function function scrollToID(id, speed){ var offSet = 0; var targetOffset = $(id).offset().top - offSet; var mainNav = $('#main-nav'); $('html,body').animate({scrollTop:targetOffset}, speed); if (mainNav.hasClass("open")) { mainNav.css("height", "1px").removeClass("in").addClass("collapse"); mainNav.removeClass("open"); } } if (typeof console === "undefined") { … -
Perform arithmetic operations on Django Subquery value
In our system, there are "Car" objects that are associated with "User" objects. With a subquery, I want to count a specific set of Car objects, perform an arithmetic operation on the result and update the User object with that value. The problem is that subqueries are expressions, not integers and I therefore can't handle them as integers. The code below does not work but you can see what I want to achieve. How should this be done? def get_car_data(): since = timezone.now() - timedelta(days=3) car_count = Subquery( Car.objects.filter( car__user=OuterRef("user"), car__user__blocked=False, created__gte=since, ) .values("car__user") .annotate(count=Count("car__user")) .order_by() .values("count") ) return { "car_count": Coalesce(car_count, 0, output_field=IntegerField()) } def calculate_values(bonus): data = get_car_data() # THIS DOES NOT WORK User.objects.update(car_bonus_counter=data["car_count"] * bonus + 100) -
LiveReload exception: <urlopen error [Errno 111] Connection refused>
Whenever i run my django project i get throw this issue, it doesn't disconnect but this error happen -
Django model field similar to forms.MultipleChoiceField
I'm trying to create StackedInline admin model that contains all users from selected group. The idea is to have dropdown field with all of my Groups and when it's changed with JavaScript "on" method to manipulate the "Users" field. Unfortunately I can't find what type of field to use in my UserChoosing model. I want it to look like this and to be able to choose multiple users. Please give me an idea what field to use or maybe how to create and connect FormModel with MultipleChoiceField. Thank you in advance! -
How to dynamically compose an OR query filter in Django to delete pairs of objects from ManyToManyFields?
if i want to implement this for delete multiple object from many to many field i need to create a dynamic filter like the below one. PizzaToppingRelationship = Pizza.toppings.through PizzaToppingRelationship.objects.filter( Q(pizza=my_pizza, topping=pepperoni) | Q(pizza=your_pizza, topping=pepperoni1) | Q(pizza=your_pizza2, topping=mushroom) ).delete() However, I want to create this query filter from a list of objects. How to do that? e.g. [{"pizza": my_pizza, "topping": pepperoni}, {"pizza": your_pizza, "topping": pepperoni1}, {"pizza": your_pizza2, "topping": mushroom}] -
Method Not Allowed: /accounts/send_invite/
I have two views that I use to send and remove a friend request on my django project. The thing is the methods used to work before and I could add friends on the site but now I've been getting 405 errors and I have absolutely no idea what's the root cause. If someone could just point me in the right direction id be very thankful. I'll put the views, templates and signals to show but I don't think the problem lies within the logic of the code because it worked before. def remove_from_friends(request): if request.method=='POST': pk = request.POST.get('profile_pk') user = request.user sender = UserProfile.objects.get(user=user) receiver = UserProfile.objects.get(pk=pk) rel = Relationship.objects.get( (Q(sender=sender) & Q(receiver=receiver)) | (Q(sender=receiver) & Q(receiver=sender)) ) rel.delete() return redirect(request.META.get('HTTP_REFERER')) return redirect('accounts:profile') def send_invitation(request): if request.method=='POST': pk = request.POST.get('profile_pk') user = request.user sender = UserProfile.objects.get(user=user) receiver = UserProfile.objects.get(pk=pk) rel = Relationship.objects.create(sender=sender, receiver=receiver) return redirect(request.META.get('HTTP_REFERER')) return redirect('accounts:profile') The urls: path('send_invite/', send_invitation, name='send_invite'), path('remove_friend/', remove_from_friends, name='remove_friend'), The template <div class="card-body"> <p class="card-text">{{obj.bio}}</p> <a href={{obj.get_absolute_url}} class="btn btn-primary btn-sm">See Profile</a> {% if obj.user not in rel_receiver and obj.user not in rel_sender %} <form action="{% url 'accounts:send_invite' %}" method="POST"> {% csrf_token %} <input type="hidden" name="profile_pk" value={{obj.pk}}> <button type="submit" class="btn btn-success btn-sm mt-2">Add to … -
Can't login to Django admin panel after successfully creating superuser using Django custom user model
After I create superuser in command line, it says the superuser is created successfully, but when I try to log in it says "Please enter the correct email address and password for a staff account. Note that both fields may be case-sensitive." I tried to delete all migrations and database and try again but it did not help. Here is my model.py from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager from django.db.models.deletion import CASCADE from django.utils import timezone from django.utils.translation import gettext_lazy # Create your models here. class UserAccountManager(BaseUserManager): def create_user(self, Email, Password = None, **other_fields): if not Email: raise ValueError(gettext_lazy('You must provide email address')) email = self.normalize_email(Email) user = self.model(Email=email , **other_fields) user.set_password(Password) user.save(using=self._db) return user def create_superuser(self, Email, Password = None, **other_fields): other_fields.setdefault('is_staff', True) other_fields.setdefault('is_superuser', True) other_fields.setdefault('is_active', True) return self.create_user(Email=Email, Password = Password, **other_fields) class Customer(AbstractBaseUser, PermissionsMixin): Email = models.EmailField(gettext_lazy('email address'), max_length=256, unique=True) Name = models.CharField(max_length=64, null=True) Surname = models.CharField(max_length=64, null=True) Birthday = models.DateField(auto_now=False, null=True,blank=True) PhoneNumber = models.CharField(max_length=16, unique=True, null=True, blank=True) Address = models.CharField(max_length=128, blank=True) RegistrationDate = models.DateTimeField(default=timezone.now, editable=False) is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_superuser = models.BooleanField(default=False) objects = UserAccountManager() USERNAME_FIELD = 'Email' REQUIRED_FIELDS = [] def __str__(self): return self.Name + " " + self.Surname … -
How do log JSON as default data in Django?
I am trying to log to a dictionary to logDNA. An idea log would look like this: logging.debug({'message': 'testing json', 'user': 490, 'status': 200}) My filters and formatters in my Django log settings look like this: 'filters': { 'meta_data': { '()': 'middleware.log_meta_data.filters.MetaDataFilter' } }, 'formatters': { 'logdna': { 'format': '%(meta_data)s' } }, And my MetaDataFilter looks like this: class MetaDataFilter(logging.Filter): def filter(self, record): if not hasattr(record, 'meta_data'): record.meta_data = {} record.meta_data['message'] = record.msg # Log a unique ID to each log request default_request_id = getattr(settings, LOG_REQUESTS_NO_SETTING, DEFAULT_NO_REQUEST_ID) record.meta_data['request'] = getattr(local, 'request_id', None) # Add the user_id from middleware record.meta_data['user'] = getattr(local, 'user_id', None) # Add the script name if len(sys.argv) > 1: record.meta_data['service'] = sys.argv[1] return True This issue is, most of my codebase has logging that looks like this: logging.info("This is a log"). So under this current setup, logDNA receives a stringified dictionary that looks like this: {'message': "this is a log", 'user': 20, 'status_code': None}' instead of the actual dictionary. Is there a way to tell Python that when logging to LogDNA, log meta_data as a dictionary, not as a string encoded dict? Something like above but with the wrapped single quotes removed, i.e: 'formatters': { 'logdna': { … -
How to translate field's title in password reset form?
I used contrib.auth in order to implement reset password function. Here is my code: <form method="post"> {% csrf_token %} {% for field in form %} <div class="form-group row" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}> <label for="{{ field.id_for_label }}" class="col-md-4 col-form-label text-md-right">{{ field.label }}{% if field.field.required %}<span class="required">*</span>{% endif %}</label> <div class="col-md-6"> {{ field }} {% if field.help_text %} <small id="{{ field.id_for_label }}-help" class="form-text text-muted">{{ field.help_text|safe }}</small> {% endif %} </div> </div> {% endfor %} <div class="col-md-6 offset-md-4"> <button type="submit" class="btn btn-primary"> cambiar contraseña </button> </div> </form> And it looks like this [![enter image description here][1]][1] But I want to translate into my language fields 'New Password' and 'New password confirmation'. Is it possible? [1]: https://i.stack.imgur.com/7GgAJ.png -
(Django) Efficiently get related objects from a ManyToManyField, sorted and limited to a count
I have a database of > 50k Persons. Each Person can own multiple Items, and each Item can be owned by multiple Persons. Person contains field Items, which is of type ManyToManyField(). I need to get 100 Person objects, sorted by number of Items owned. Also for each Person I need 10 Items, sorted by a "rarity" field (just a number). The problem is that the first part of the query (getting the Person objects) is really fast, and the second part takes 100 times longer, which makes sense because I can see it makes a separate query for each Person. Here is my code: persons = Person.objects.all().order_by('-items_count')[:100] for person in persons: items = person.items.all().order_by('rarity')[:10] # Do stuff, build a response object items_count is a precomputed field with number of Items owned. I know I can annotate it on the fly, I was just experimenting to optimize the query. The whole thing takes over a second. Is there a way to combine both queries into one, or change my models somehow to optimize this? Here are my models: class Item(models.Model): name = models.CharField(max_length=50) # Other fields... class Person(models.Model): name = models.CharField(max_length=50) items = models.ManyToManyField(Item, related_name='owners') # Other fields... -
How to route specific urls in a django app?
I would like to know if there is a way to include only specific url endpoints in my Django urls.py. Lets say i have a app called auth with this auth/urls.py urlpatterns = [ url(r'^password/reset/$', PasswordResetView.as_view(), name='rest_password_reset'), url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), url(r'^login/$', LoginView.as_view(), name='rest_login'), url(r'^logout/$', LogoutView.as_view(), name='rest_logout'), url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), url(r'^password/change/$', PasswordChangeView.as_view(), name='rest_password_change'), ] Now I have a urls.py like that: urlpatterns = [ path('/', include('dj_rest_auth.urls')) ] this includes all endpoints from auth/urls.py. Is there a way to select (in urls.py) which URL to include? Lets say I only want login and logout to be included on my urls.py. urlpatterns = [ path('/', include('dj_rest_auth.urls.rest_login')), path('/', include('dj_rest_auth.urls.rest_logout')) ] Something like that, how can I make it work? -
How to get the latest version of a all previously distinctable objects within a single query in django?
I have a model with a version field. class Workflow(models.Model): ... process_id = models.CharField(null=False, max_length=100) # not unique! version = models.IntegerField(default=1) enabled = models.BooleanField(default=True, null=False) I'm trying to find the latest version for each process_id within a single query. Basically, I want to do the following: class WorkflowFilterSet(django_filters.FilterSet): ... only_latest_versions = django_filters.BooleanFilter(method='get_only_latest_versions') def get_only_latest_versions(self, queryset, field_name, value): if value: workflows = [] for worflow in queryset.distinct('engine_bpmn_process_id'): workflow_ = queryset.filter(engine_bpmn_process_id=worflow.engine_bpmn_process_id, enabled=True).latest('version') workflows.append(workflow_) return workflows # even if I wanted to do like this I can't because I must return a QuerySet return queryset How can I do the above with a single query? Thank you very much! -
Django app request not found after changing site URLs
I have a webpage that does an async request on startup to fetch a JSON file: controller.js $.ajax( { url: '/get_lines/', data_type: 'json', success: function(data) { fillLinesMenu(JSON.parse(data)) $("#form-lines option:eq(1)").attr("selected","selected"); $("#form-lines").selectmenu("refresh") } } ) project/field_plot/urls.py urlpatterns = [ url(r'^get_lines/$', views.get_lines, name='get_lines'), url(r'^get_plot/$', views.get_plot, name='get_plot'), url(r'', views.index, name='index'), ] project/urls.py urlpatterns = [ path('admin/', admin.site.urls), path('sky_map/', include('sky_map.urls')), path('', include('field_plot.urls')), ] This has been working fine for quite a while. As you can see, I've been working on field_plot - hence the empty url, to simplify page loading - but now I need to assign this app to its specific project-level URL: project/urls.py urlpatterns = [ path('admin/', admin.site.urls), path('sky_map/', include('sky_map.urls')), path('field_plot/', include('field_plot.urls')), ] Now I need to load http://localhost:8000/field_plot/, as predicted, but changing the last path breaks /get_lines/ and other URLs I use for AJAX requests. What am I missing? -
How to receive context data in django template and work with it in javascript
I am trying to receive context data in django template and work with it in javascript. Currently i am receiving the data but as a string and it looks gibberish. my code: {% extends "base.html" %} {% block content %} {% if search_list %} <!-- do something --> {% endif %} <!-- javascript code --> {% block script %} <script > let data = '{{search_list}}' console.log(data); </script> {% endblock script %} {% endblock %} If i remove the quote in the variable search_list in javascript it shows me error. i have used jsonify and safe tag it doesn't work. How do i get the data as an object here? -
Transform dict in nested dict
How to transform a dictionary with str keys separated by '__' into a nested dictionary, for example, transform from that { age:1, name__first:'jhon', name__last:'wick', location__street:'avenue', location__coordinates__latitude:222, location__coordinates__longitude:222, } to that { age:1, name:{ first:'jhon', last:'wick', } location:{ street:'avenue', coodinates:{ latitude:222, longitude:222, } } } -
How to perform Outer Joins using Django ORM?
I have the following models: class Partner(models.Model): partner_name = models.CharField(max_length=50) class Allocation(models.Model): partner = models.ForeignKey( Partner, related_name='partner_allocations', on_delete=models.CASCADE ) is_allocated = models.BooleanField(default=False) By using Django ORM, I need the joined tables with columns as ['partner_name', 'partner_id', 'is_allocated']. All partner names(unrelated too), and related data from Allocation model. SQL = SELECT partner.id, allocation.partner_id, allocation.is_allocated FROM Partner LEFT OUTER JOIN Allocation ON Partner.id=Allocation.partner_id or SQL = SELECT partner.id, allocation.partner_id, allocation.is_allocated FROM Allocation RIGHT OUTER JOIN Partner ON Allocation.partner_id=Partner.id The output for the above SQL using Django ORM. The syntax for SQL queries might be wrong here, but they give the overall idea. I want to use raw SQL only as the last option. Please, can someone help. -
Not getting results from mysql using query in views in django
I am using MySQL database which and try to filter data according to date but while using filter I am getting nothing.While i uncomment this line print(searchresult.Date) then it will show error 500. Here is my view.py from sales.model import Mar21 def show(request): if request.method == 'POST': fromdate = request.POST.get('startdate') todate = request.POST.get('todate') # date = Mar21.objects.only('Date') print(fromdate) print(todate) searchresult = Mar21.objects.filter(date__lte = fromdate,date__gte = todate) # print(searchresult.Date) return render(request,'front.html',{'data':searchresult}) else: data = Mar21.objects.all() # print(data) return render(request,"front.html",{'data':data}) Here is my model from django.db import models class Mar21(models.Model): id = models.IntegerField(db_column='Id', blank=True, null=True) # Field name made lowercase. date = models.DateField(db_column='Date', blank=True, null=True) # Field name made lowercase. sales_channel = models.TextField(db_column='Sales Channel', blank=True, null=True) # Field name made lowercase. Field renamed to remove unsuitable characters. sales_order_id = models.FloatField(db_column='Sales order ID', blank=True, null=True) # Field name made lowercase. Field renamed to remove unsuitable characters. ship_to_name = models.TextField(db_column='Ship to name', blank=True, null=True) # Field name made lowercase. Field renamed to remove unsuitable characters. sku = models.TextField(db_column='SKU', blank=True, null=True) # Field name made lowercase. normal_sku = models.TextField(db_column='Normal SKU', blank=True, null=True) # Field name made lowercase. Field renamed to remove unsuitable characters. vendor = models.TextField(db_column='Vendor', blank=True, null=True) # Field name made lowercase. quantity = … -
LoginTestListView is missing a QuerySet. Define LoginTestListView.model, LoginTestListView.queryset, or override LoginTestListView.get_queryset()
Why such a mistake? Request Method: GET Request URL: http://127.0.0.1:8000/auth/login/ Django Version: 2.2.18 Exception Type: ImproperlyConfigured Exception Value: LoginTestListView is missing a QuerySet. Define LoginTestListView.model, LoginTestListView.queryset, or override LoginTestListView.get_queryset(). Exception Location: C:\Users\isp06\Documents\test\geekshop-server\venv\lib\site-packages\django\views\generic\list.py in get_queryset, line 35 Python Executable: C:\Users\isp06\Documents\test\geekshop-server\venv\Scripts\python.exe Python Version: 3.9.2 Python Path: ['C:\Users\isp06\Documents\test\geekshop-server\geekshop', 'C:\Users\isp06\Documents\test\geekshop-server\geekshop', 'C:\Program Files\JetBrains\PyCharm ' '2020.3.3\plugins\python\helpers\pycharm_display', 'C:\Users\isp06\AppData\Local\Programs\Python\Python39\python39.zip', 'C:\Users\isp06\AppData\Local\Programs\Python\Python39\DLLs', 'C:\Users\isp06\AppData\Local\Programs\Python\Python39\lib', 'C:\Users\isp06\AppData\Local\Programs\Python\Python39', 'C:\Users\isp06\Documents\test\geekshop-server\venv', 'C:\Users\isp06\Documents\test\geekshop-server\venv\lib\site-packages', 'C:\Program Files\JetBrains\PyCharm ' '2020.3.3\plugins\python\helpers\pycharm_matplotlib_backend'] Server time: Fri, 26 Mar 2021 17:18:20 +0000 enter code here class LoginTestListView(ListView): template_name = 'authapp/login.html' form_class = UserLoginForm def get_context_data(self, **kwargs): context = super(LoginTestListView, self).get_context_data(**kwargs) context['title'] = 'GeekShop - Авторизация' return context enter code here urlpatterns = [ path('login/', LoginTestListView.as_view(), name='login'), path('register/', register, name='register'), path('profile/', profile, name='profile'), path('new-logout/', new_logout, name='new_logout'), enter code here class UserLoginForm(AuthenticationForm): class Meta: model = User fields = ('username', 'password') def __init__(self, *args, **kwargs): super(UserLoginForm, self).__init__(*args, **kwargs) self.fields['username'].widget.attrs['placeholder'] = 'Введите имя пользователя' self.fields['password'].widget.attrs['placeholder'] = 'Введите пароль' for fild_name, field in self.fields.items(): field.widget.attrs['class'] = 'form-control py-4' -
Django doesn't load build/static files ReactJS
Hello I have try make a website using ReactJS and Django with RESTAPI. When i run npm start and python manage.py runserver separatly that work perfectly. But when i try to render the index.html with django from the react/build. It doesn't work. It render a blank page with the error that follow. There is the error. There is my files. settings.py import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'zn(=yq@vvasu)(-1qqj*q(ubl6gwxpl)ff8vs+lqpvuq!d(3(q' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [ "127.0.0.1" ] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'corsheaders', 'rest_framework.authtoken', 'rest_auth', 'polluser.apps.PolluserConfig', 'restapi.apps.RestapiConfig', 'django.contrib.sites', 'allauth', 'allauth.account', 'rest_auth.registration', ] SITE_ID = 1 MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'corsheaders.middleware.CorsMiddleware', ] ROOT_URLCONF = 'template.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.path.join(BASE_DIR, 'static'), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'template.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'essaitest', 'USER': 'pass', 'PASSWORD': 'pass', … -
Can anyone tell me what this pseudocode means?
Can anyone please explain to me what the pseudocode is all about as it'll be really helpful as I need to create a function in python for this Fuzzy Yara Rules Pseudocode -
Is it bad if I have a lot of options in my model choice field?
I created cities.py file which contains all cities of my country (it's 20 kb of data) in list CITY_CHOICES. I have a model with city row, I imported CITY_CHOICES and set it as choices for this row: city = models.CharField(max_length=63, choices=CITIES_CHOICES, blank=False, null=True) Is it too much? Will I experience performance issues? Sorry, if it's a dumb question. By the way I use MySQL. -
Can I know everything about python?
I've recently started learning Django. I am picking up the syntax and everything seems to be going on well. I have taken full python courses (including college) before diving into Django. However, every day I see something new in python that I don't know. I do get overwhelmed that my knowledge in Python is not just yet good enough and have to read a lot. Can I know everything about python??