Imagine I have the following code: qs = Users.objects.all() list = [] for i in range(10): list.append(qs.filter(age=i)) here the filter is called 10 times
I'm really new to this stuff, I'm a 16 year old currently doing a research project/internship, and I've just started 2 weeks ago. So I'm extremely confused. I'v
I need to set the default DB schema for a Django project, so that all tables of all apps (including 3rd party apps) store their tables in the configured Postgre
Python version: 3.6.3 Django version: 3.0.8 I am trying to use enable Django's error reporting via email, but nothing seems to happen when I encounter a 500 err
I created a article models below models.py class Article(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True) is_deleted
i have a model course and i also have a model review and rating that allows users rate a particular course. now i want to count all the ratings on each course w
I am able to create a New User using the "register" endpoint. I can the user being created on the admin page as well. When I try to get an access token for the
I have to do some checks all the time with the context proccessor.The value must be 'True' as soon as the user logs in.But when navigating the site after loggin
I need your help with understanding try-except python/Django. so I have this function: def submit_dept_head_application(request, application_id): cv = request.F
I created a magzine model in django. But their are more than three authors of a magzine. I have written below code for three authors. If I write the code of two
I have done this before and may be it did work properly that time but now suddenly it's not working as it's expected to be. The viewset.py: class ProfileView
Problem: I cannot get images to appear on my template plant_detail.html. I think I'm calling on variables incorrectly, but not sure what to change. Context: I c
I am struggling to create the correct prefetch behavior in Django. Here is the outline of the problem: Each Account has DailyQuotes, updated daily at different
I want to get url by name specified in urls.py. Like {% url 'some_name' %} in template, but in Python. My urls.py: urlpatterns = [ ... path('admin_secti
If this form submits as invalid, I want to override the htmx and do a HttpRedirectResponse that refreshes the full page instead of just changing the div, #super
When running the vercel command in Ubuntu terminal: Error! Command failed: python3.6 /tmp/2de7da56/get-pip.py --user ERROR: This script does not work on Pyth
I'm trying to add search bar in my application but I don't know how to query a database to gives the things that user's search for. I want when user search for
so i make this app in which you can make products. And those products have an image that was saved in a file while i was using this app localy. I deployed my ap
ImportError: cannot import name 'url' from 'django.conf.urls' (/home/chams/pfe_project/CarApp/venv/lib/python3.8/site-packages/django/conf/urls/_init_.py) I can
I have the below model. Departments, users. Users are assigned to a department. How can I restrict the access of templates based on the department_name of a use