Django 4 Need user to be able to upload either an archive of images or just a few images at a time. Then these pages are numbered according to the order in which the user has placed them and stored …
From product.models import Product CART_SESSION_ID = 'cart' class Cart: def __init__(self, request): self.session = request.session cart = self.session.get(CART_SESSION_ID) if not cart: cart = self.session[CART_SESSION_ID] = {} self.cart = cart def __iter__(self): cart = self.cart.copy() for item in cart.values(): item['product'] = …
I am trying to access the media files using Nginx. The file exists in the directory: /usr/src/app/backend/media/profile/c4ebe33d-7da1-4a62-bb17-8da254d69b36, where the part profile/c4ebe33d-7da1-4a62-bb17-8da254d69b36 is created dynamically. The media root is: /usr/src/app/backend/media. I know the file exists cause I am able to see …
I have this function in react to fetch the data from my django API: const [filterData, setFilterData] = useState([]); const fetchFilterData = async () => { const filter_url = 'http://127.0.0.1:8000/api/filters/' try { const response = await fetch(filter_url) const result = …
When I deploy my Django app on rail after adding nessary variables and updated file everything done unless this failed do u know why and how to fix it Build logs on railway;here the problem how can i fix it"#8 …
I have a problem. I'm new to django. And so the error lies in the fact that nothing happens during the data transfer. The database is not being updated. I will be very grateful for your help! this is code: …
I have recently started learning Django Rest Framework, and hit a little roadblock trying to understand the data flow in DRF. From what I understand, views take in a web request and return a web response, so they are the …
Background I have a custom User model that I have extended from BaseUserManager and AbstractBaseUser. Similarly, I have a custom sign-up form that I've extended from UserCreationForm (all these custom items are extended from django.contrib.auth). The custom UserCreationForm I've made …
I was trying to start a new project in django and ran into this error.enter image description here i already created venv and installed django with venv activated.But even after successfull installlation of django i can't run …
Curretly, I want to add CMS feature in my current website, which lib would you recommend? Hi, I already using Django build a simple website, but don't have CMS feature yet. Recently, I want to add CMS feature in the …
We have a problem with displaying images on html pages. We create graph, save it and then pass it's url to html page via context, but django can't find the picture (Error 404 Not Found). There's no model to store …
I have a single endpoint written using django ninja. This endpoint executes a crawler that performs several requests. The sequence of requests has 3 different routines depending on whether or not the crawler already has valid login credentials in its …
I have a problem. When clicking on the link http://127.0.0.1:8000/accounts/register / returns the KeyError error at /accounts/register/ 'email'. I program in django in pycharm. I want to point out that there is a specific 'email' error here! …
I have a Django project with the following urlpattern defined on project level: urlpatterns = [ path('', include(('ws_shopify.urls', 'ws_shopify'), namespace='shopify')), ] The file ws_shopify.urls defines the following urlpatterns: urlpatterns = [ path('api/shopify/', ShopifyWebhookAPIView.as_view(), name='webhook'), ] The class ShopifyWebhookAPIView …
Case: I have relationships: 1 Distributor:M resellers, 1 reseller: M customers, 1customer: M domains, 1 Domain: M mailboxes. The model admin panel is taking a long time to load the objects for all the model admin. Does the default django …
In Django orm we have queryset.iterator https://docs.djangoproject.com/en/5.0/ref/models/querysets/#iterator that uses under the hood Postgres cursor www.postgresql.org/docs/current/sql-declare.html in case we using Postgres as a database of course. By default Django uses it with WITHOUT HOLD setting, …
There. I'm using django python. I've custom user model. I've created a separate django signals file. there is my method. I'm importing them in my apps.py and wanting to use there. cause, post_migrate signals are working that way. but post_save …
I have the following problem, which has been difficult for me to find documentation on function-based views to document them with drf_spectacular since all this is found for class-based views I have tried different ways to document the requestBody in …
Given a list of arbitrary Django models, how can you use the Django ORM to generate the JOIN statements for an SQL query? This of course will only work if the relationships are defined in the model and there is …
I already created an animation in dom for the login and registration but the only thing I need is to validate the registration and I already have the registration with django but I need it to show me the error …
CRUD operations are working just fine when I check the admins site. All of the new created items, updated or deleted are shown in the admins site, but in order to make the data appear in the website I have …
Hi I finished making my contact form but it doesn't let me send email, I'm using mailtrap as a test server but I get an error. I'm using Django 5.0 and Python 3.10 Settings.py # Email config EMAIL_HOST = 'sandbox.smtp.mailtrap.io' …
I am building a game tracker. I would like to have it where if the user selects anything other than 'Win' then the wincon field of the form is unchangeable or set to a default field. This is to make …
I need to run next some years Django on IIS (don't ask why :-). I found two ways https://learn.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2022 1. httpPlatform + runserver wsgi.multithread:True wsgi.multiprocess:False The solution is multithreaded, working almost well, low resources, good performance. 2*5 …
I am using Django Rest Framework and Grappelli in my Django project. I need to add a cookie consent notice. Is it possible to customize both to show the notice? Do I need to create a new template?
I'm encountering an issue with Django where form submission is not redirecting to the success page as expected and the data input its not happening . Here's a breakdown of the problem: I have a Django application where users can …
Have a question on using docker-compose when entering into debug mode by manually setting breakpoint(). This is my service and it has a /health which calls almost every 5s, and it prints out 200 status code to stdout. However, when …
So this is my views.py when I use atrakcjatest my images work, but when I try to use the filtered atrakcja(atrakcje_list) it doesnt work and only images dont work, the rest of variables are ok def map_view(request, trasa_id): trasa = …
I want to deploy my django project which is face recognition for online transaction on render but it show ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects how could i resolve this ? i …
In my Django app with Graphene for GraphQL, how do I intercept the Graphene GraphQL messages so I can sanitize the content? I tried creating a custom graphql view and a custom_execute function and using that in the urlpatterns endpoint …
I'm facing a strange issue with Django. I have set up a simple form in a template that submits to a view, but I'm not getting the expected 404 response. Instead, I'm being redirected to the URL http://localhost:8000/clear/ without seeing …
I'm having trouble uploading my Django web app to Heroku due to the Slug Size limit. My web app includes an AI API that requires a torch dependency. This is the error: Compressing... remote: ! Compiled slug size: 700M …
I've a certain code that updates bulk rows: from simple_history.utils import bulk_update_with_history from django.utils.timezone import now bulk_update_list = [] for chart in updated_chart_records: chart.coder_assignment_sequence = count chart.queue_id = work_queue_pk chart.level_id = role_id updated_num = bulk_update_with_history(bulk_update_list, Chart, ["coder_assignment_sequence", "l1_auditor_assignment_sequence", "l2_auditor_assignment_sequence", "l3_auditor_assignment_sequence","queue_id", …
I have a project with the following urls.py. urlpatterns = [ path('category*/', include('student.urls')) // * could be replaced by a number ] In that project I then have an application student whose urls.py looks like this: <pre …
I am trying to get the user's login and password from the HTML template (from ) and use these inputs for processing. I want to use the inputs from the HTML template and not the usual Django forms, like: <label …
I have following django models : class ModelA(models.Model) : # fld1, fld2 class ModelB(models.Model) : fld_a1 = models.ForeignKey(ModelA, related_name='modela_1') fld_a2 = models.ForeignKey(ModelA, related_name='modela_2') # other fields Now when I delete resource from ModelB, how to make sure that the …
I have a Django application that has large I/O-bound tasks. I use Celery to run these tasks in threads and manage the progress in the UI with a progress bar. Here's my configuration : Django version : 5.0.2 Celery version …
I building a multitenants project using django-tenant and django-tenant-user but I am facing a weird issue where the CSRF TOKEN and email fields of my login form are being overwritten with the password data after a failed login attempt. Please …
I have made a REST API using Django, and I have issues with retrieving a user's information by inserting a token. I am using the User model. So here is the view: class getUserInfoView(APIView): #generics.RetrieveAPIView #authentication_classes = [authentication.TokenAuthentication] …
I want to show some information on the admin index.html, but I do not want to use context processors for this, but have my own view. So I tried like described in the docs and discussed <a …