Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How many lines of code does a website have with strong authentication and content management? [closed]
As someone who doesn't know much about technology, I wonder what's behind my everyday things? And how many lines of code do they have? I know this isn't specifically a problem, but I'm curious and would like to know, My apologies if it sounds a bit 'stupid' -
difficulty assigning a ForeignKey value field to a form within a loop
I'm encountering an issue with assigning a ForeignKey value to a form field within a loop. I have a Django application where users can submit answers to questions, and each answer can have multiple comments associated with it. To allow users to add comments to each answer, I've implemented a form within a loop. However, when users submit a comment using the form, instead of creating a CommentAForm object, it is creating a CommentQForm object. Despite attempting to pass the answer ID as a hidden field within the CommentAForm, the value doesn't seem to be correctly assigned to the CommentAForm. As a result, comments are not being associated with the correct form or model object, i don't know what is going on, How can I fix it views: def view_question(request, slug): question = get_object_or_404(Question, slug=slug) answers = Answer.objects.filter(post=question) answers_comment = CommentA.objects.filter(post__id__in=answers) # this is the comment form for each question if request.method == 'POST': comment_form = CommentQForm(request.POST) if comment_form.is_valid(): my_comment_form = comment_form.save(commit=False) my_comment_form.user = request.user my_comment_form.post = question my_comment_form.save() return redirect('View_Question', slug=slug) else: comment_form = CommentQForm() # This is the comment form each answer if request.method == 'POST': answer_comment_form = CommentAForm() if answer_comment_form.is_valid(): my_answer_comment_form = answer_comment_form.save(commit=False) my_answer_comment_form.user = request.user my_answer_comment.post … -
In mongodb(pymongo) how could i create only the missing path in a nested document
Im using django and mongoDB connected by Pymongo. And i made a collection of users that inside each user there are details, and a calender when the user first register the calendar is an empty array(could be changed if needed), in the calendar would be a list of years, inside every year a list of months, inside every month would be a list of days, and in every day a list of events. And i need that when a user wants to add an event to a specific date it would add it to the correct path meaning if the specified year allready exists it would insert the event in it and so on for the month and day. But if the year isnt exist yet it would create the needed path. Every thing i tried or not updating at all, or adding duplicates and ignores the allready created data. Does someone has a solution for that case? And if thats not the correct architecture for a mongo database feel free to improve it. Thank you very much. For example i tried users = db["users"] users.update_one({"_id": user}, {"$addToSet": {"year": year, "months": [{"month": month, "days": [{"day": day, "events": [new_event]}]}]}}}, upsert=True) But … -
the question is how to use LogoutView class in django to log out the user and also to redirect him to a specific url
misundersting of the usage of LogoutView based class. I would like to ask for an example in how to use this class to logout the user. I tried to use pass inside the class but it redirect me to an empty page -
How to run multiple websocket client connections?
Apologies in advance if this is a redundant question, I'm asking it here as the last resort, after having gone through a lot blogs & articles. Here's the situation: I have a django service(let's call it the "main" service) running an HTTP server & a WebSocket server using django-channels. I have a bunch of other django services(call them target services) wanting to connect to the websocket channels exposed by the main service And target each service needs to establish multiple websocket connections with the main service, and send/receive messages as long the connection is not closed by the main service. Here're some sample connection URLs: URL1 = "wss://main-service.com/ws-connection/1" URL2 = "wss://main-service.com/ws-connection/2" URL3 = "wss://main-service.com/ws-connection/3" And this list of URLs is obviously not known in advance, the main service sends us a mini payload which is used to generate the URL at runtime, and connection is established. The target service needs to have the ability to maintain thousands of websocket connection(serving as stateful connections) & it also needs to expose an HTTP API to serve direct requests. So far, I have gotten the target service API running as django project, and a basic websocket client, and the two look like this: … -
"... && coverage report" not working after switching to pytest-django
I was using unittest in Django to write tests and running the tests with this command: coverage run --omit='src/manage.py,src/config/*,*/.venv/*,*/*__init__.py,*/tests.py,*/admin.py' src/manage.py test src && coverage report It'd run the tests then display the .coverage generated by coverage run ... after running. After installing pytest-django and setting up pytest.ini, I've updated my command to: coverage run --omit='src/manage.py,src/config/*,*/.venv/*,*/*__init__.py,*/tests.py,*/admin.py' -m pytest && coverage report Note, I'm not using pytest-cov just yet. For some reason I can't figure out, the coverage report is not being displayed after the tests run. I can run each commands separately: The coverage run ... runs the tests and generates the report. The coverage report displays the report. I just can't get the report to display doing ... && coverage report after switching to pytest-django. Any reason for this? Versions: coverage = "^6.2" pytest-django = "^4.7.0" -
trouble in installation of django
I have been facing many issue regarding installation django on windows using pip. i have used "pip install django". But I am unable run the command "django-admin startproject myproject" it is showing following error: 'django-admin' is not recognized as an internal or external command, operable program or batch file. Please help me in installation of django on windows 11. please proide me with commans that to be run for installation in detail. -
How to test django channels between two physical devices over a wifi network
Can someone help me configure my django channel app in order for me to be able to test the chatting feature between two users. They must use two different devices and chat over a wifi network Looking through the net I can't find anything -
communication between the server and the user
Front end (React) and Back end (Django) are working on the local server and are sending information to the user, but the Front end code has been updated and the local server is working, but the users still see the old interface, what's the problem? please advise copied and pasted the new changes into the old code and added a new library, the program is working but the new changes are not visible with the old code -
Django login issue: Redirect to user panel not working despite status 200 in console [closed]
I'am building application in django and tailwind css to asking legal questions. I created user in django admin panel, created views etc. But after login(it is success 200 status), it doesn't work. I can't redirect user after login to user panel. How to do it, and where is error? https://github.com/marpot/lex_question Title: I'm encountering an issue with Django authentication where despite receiving a status 200 in the console upon logging in, I'm not redirected to the user panel as expected.I tried to change urls but it's incorrect I think. -
DjangoAdmin render BinaryField as image
I wrote middleware to catch requests and view them on admin page. It successfully views raw text request body, but fails on image render. admin.py class RequestLogEntryAdmin(admin.ModelAdmin): fieldsets = ( ('Request', { 'fields': ('request_headers', 'request_size', 'request_body_'), }) ) def request_body_(self, obj): if b'Content-Type: image/png' in base64.b64decode(obj.request_body): return obj.image_handler(bytes(obj.request_body)) return bytes(obj.request_body) models.py class RequestLogEntry(models.Model): # ... request_body = models.BinaryField(null=True) # ... def image_handler(self, binaryfield): return mark_safe(f'<img src="data:image/png;base64,{binaryfield}" width="150" height="150" />') Before saving request.body is being base64 encoded middleware.py # ... log_entry.request_body = base64.b64encode(request.body) # ... Current code produces the following: Base64 decoded request.body looks like this: My guess is that some extra data being mixed with the image bytes (like 'Content-Disposition' and 'Content-Type' headers), but I'm not sure how can I cut it out from the request body. -
AutocompleteFilter must inherit from 'FieldListFilter'
I want to write custom filter with drop down field using admin_searchable_dropdown I tried two ways too implement this and got error both times first way: the custom filter class PrimaryLabelFilter(AutocompleteFilter): field_name = 'primary_label' title = 'primary_label' in the admin using it like this list_filter = ( PrimaryLabelFilter, ) the error Forbidden (Permission denied): /admin/autocomplete/ model_admin = self.admin_site._registry[remote_model] ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ KeyError: <class 'panel.backend.ad.models.label.Label'> HTTP GET /admin/autocomplete/?app_label=ad&model_name=ad&field_name=primary_label 403 [0.01, 127.0.0.1:52324] second way: in admin class list_filter = ( ('primary_label', PrimaryLabelFilter), ) the error <class 'panel.backend.ad.admin.ad.AdAdmin'>: (admin.E115) The value of 'list_filter[0][1]' must inherit from 'FieldListFilter'. -
Git like view for dataframe comparison
I have two dataframe set called df1 and df2. I need to create a view in django template to compare these two dataframe in side by side. It should be looks like the git like comparison like below. I have tried the below but didn't work views.py # Convert DataFrames to lists of dictionaries for easier iteration df1_data = df1.to_dict(orient='records') df2_data = df2.to_dict(orient='records') # Combine the data to be passed to the template combined_data = list(zip(df1_data, df2_data)) return render(request, self.view_template,{ 'combined_data': combined_data } ) template {% block content %} <style> .row { display: flex; flex-direction: row; justify-content: space-between; } .column { flex: 1; } </style> <div class="container"> {% for row1, row2 in combined_data %} <div class="row"> <div class="column"> {% for key, value in row1.items %} <p>{{ key }}: {{ value }}</p> {% endfor %} </div> <div class="column"> {% for key, value in row2.items %} <p>{{ key }}: {{ value }}</p> {% endfor %} </div> </div> {% endfor %} </div> {% endblock %} -
weasyprint "Document has no attribute write_png"
I am writing a webapp in Python and Django. I use weasyprint to write pdf documents and I would like to use write_png() to get a png thumbnail of each pdf. This is from my views.py: pdf_letter = weasyprint.HTML(string=letter, base_url=static_url).render( stylesheets=[weasyprint.CSS(static_url + "/abrechnung/css/print-portrait.css")] ) pdf_table = weasyprint.HTML(string=table).render( stylesheets=[weasyprint.CSS(static_url + "/abrechnung/css/print-landscape.css")] ) val = [] for doc in pdf_letter, pdf_table: for p in doc.pages: val.append(p) pdf_file = pdf_letter.copy(val).write_pdf(f"{datetime.now()}.pdf") thumbnail = pdf_letter.copy(val).write_png(f"{datetime.now()}.png") When I try to run the program, I get the following error message in the browser: 'Document' object has no attribute 'write_png' pdf_file = pdf_letter.copy(val).write_pdf(f"{datetime.now()}.pdf") thumbnail = pdf_letter.copy(val).write_png(f"{datetime.now()}.png") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The weasyprint documentation on the write_png() function can be found here: https://doc.courtbouillon.org/weasyprint/v52.5/api.html#weasyprint.document.Document.write_png As I read the weasyprint documentation, I states that weasyprint.HTML.render() produces a weasyprint.document.Document. Said object has a function write_png(). Soooo.... WTF? What am I doing wrong here? I tried this for i, page in enumerate(document.pages): document.copy([page]).write_png('page_%s.png' % i) and this for page in document.pages: yield document.copy([page]).write_png() from the weasyprint tutorial (variables etc. adapted to my code of course) but none of both worked - I got the same error. Writing the pdf file alone is no problem, it is saved and returned later on. Problems just started when I … -
'svc_payment_dev'. The domain name provided is not valid according to RFC 1034/1035
Upon sending requests to the dockerized Django app through the API gateway layer using the container name (svc_payment_dev), I faced an issue indicating that the domain name provided is not valid acoarding to RFC 1034/1035 I know that underscores are typically not allowed in hostnames, and unfortunately, I'm unable to modify the container name at this time.So. I'm currently seeking a solution to modify the validation hostname in Django. Also, I've added the hostname to ALLOWED_HOSTS list but still encounter the "invalid hostname" error. ALLOWED_HOSTS = [ 'svc_payment_dev:8000' ] -
Nginx and SSL configuration inside docker container is not working
Am using following nginx conf file : server { listen 80; server_name domain; # Redirect HTTP to HTTPS return 301 https://$host$request_uri; } server { listen 443 ssl; server_name localhost; ssl_certificate /etc/nginx/cert/ddomain.crt; ssl_certificate_key /etc/nginx/cert/domain.key; location / { proxy_pass http://0.0.0.0:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } I am using the following docker file to run the container. This container runs 8000 port. FROM python:3.8 # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ gettext \ dbus \ libdbus-1-dev \ libcups2-dev \ libcairo2-dev \ libgirepository1.0-dev \ libgtk-3-dev \ libsecret-1-dev \ pkg-config \ wget \ nginx \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file and install Python dependencies COPY requirements.txt /app/ RUN pip install --no-cache-dir -r requirements.txt # Copy SSL certificate files COPY ssl_certificates/domain.crt /etc/nginx/cert/domain.crt COPY ssl_certificates/domain.key /etc/nginx/cert/domain.key # Copy the Nginx configuration file COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy the rest of the application files COPY . /app/ # Expose port 8000 to allow communication to/from server EXPOSE 8000 # Your application's command to run CMD ["python", "manage.py", "runserver", … -
Nginx gives 403 Forbidden error serving files
I am a newbie to nginx and run into a problem: nginx response with 403 Forbidden when I request example.com/media/ and all files inside the media folder. I am creating web application with python using Django Rest Framework. Here is my nginx file in /etc/nginx/sites-enabled/example.com: server { server_name example.com; access_log /var/log/nginx/example.com-access.log; error_log /var/log/nginx/example.com-error.log; location /media/ { alias /root/spaceai/backend/SpaceAI_Backend/apps/media/; } location / { client_max_body_size 0; gzip off; ## https://github.com/gitlabhq/gitlabhq/issues/694 ## Some requests take more than 30 seconds. proxy_read_timeout 300; proxy_connect_timeout 300; proxy_redirect off; proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:8000; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = example.com) { return 301 https://$host$request_uri; } # managed by Certbot server_name example.com; listen 80; return 404; # managed by Certbot Here is media folder rights: drwxr-xr-x 3 755 root 4096 May Head of /etc/nginx/nginx.conf: user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # … -
DRF Forbidden (CSRF cookie not set.) from React axios POST request
As we know, we don't have access to Django CSRFToken in React by default, So we have to get it somehow. The solution was make a URL for receive CSRFToken in Response-Headers and set csrftoken cookie in browser. So I did it => Views.py @method_decorator(ensure_csrf_cookie, name='dispatch') class GetCSRFToken(APIView): permission_classes = (permissions.AllowAny, ) def get(self, request, format=None): return Response("CSRF cookie set.") CSRFToken.jsx import React, { useState, useEffect} from 'react'; import axios from 'axios'; export default function CSRFToken(){ useEffect(()=>{ const fetchData = async () => { try { const url = 'http://localhost:8000/csrf_cookie' const response = await axios.get(url,{ withCredentials: true, }).then(()=>{ console.log("CSRF Cookie set.") }) } catch (error) { console.error('Error fetching data:', error); } }; fetchData(); }, []); return ( <> </> ) } Result => After that we can access to csrftoken and We can send it through X-CSRFToken Request-Headers. But the problem is when I send the request Django side won't accept that csrftoken and will reject that request. settings.py ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'corsheaders', 'App.apps.AppConfig' ] MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', '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', ] CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_CREDENTIALS = True CSRF_TRUSTED_ORIGINS = ['http://localhost:5173'] Views.py @method_decorator(csrf_protect, name='dispatch') class … -
Avoid app name appending in table name in django
I have implemented database routing in django. I am creating tables in two different database using database routing in django. The issue is app name is appended in database table name. I am using prosgreSql database. I tried to mention db_table with value in class Meta, but it is not working for me. I am expecting only table name in database. I am using prosgreSql database -
disable dark mode in bulma 1.0
I tried disabling the dark mode in my base.css like bulma describes in their docs by adding the @media lines: @media (prefers-color-scheme: light) { :root { } } body { display: flex; min-height: 100vh; flex-direction: column; } ... This is how I import them in my base.html: <!DOCTYPE html> <html lang="en"> <head> <title>{% block title %}app{% endblock title %}</title> {% block css %} <link rel="stylesheet" href="{% static 'css/bulma.css' %}"> <link rel="stylesheet" href="{% static 'css/bulma-extensions.min.css' %}"> <link rel="stylesheet" href="{% static 'css/bulma-switch.min.css' %}"> <link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="{% static 'css/base.css' %}"> {% endblock %} </head> <body> ... </body> </html> I also tried using <body data-theme="light"> but this only affected the footer, and not the content in the body. Also adding the data-theme tag to other elements did not change anything. I want to get rid of darkmode all over the page. How would I do that? Switching the dark mode systemwide to light works though. -
How to debug Okta SAML2 authentication issue in a React + Django application?
I'm integrating Okta SAML2 authentication into my React + Django application. However, despite not encountering any errors, when I attempt to access https://org.okta.com/app/org_lighthousedev_1/exk14dabkz9lmSTEq0x8/sso/saml, it redirects me to https://dev-lighthouse.corporate.org.com/accounts/login/?next=/sso/saml/ instead of completing the SAML authentication flow. I'm unsure how to debug this issue. I'm using djangosaml2==1.9.2 and djangorestframework-simplejwt==5.3.1. Could someone provide guidance or hints on what might be missing by reviewing the code snippet below? These where I gave in okta request for application creation Single sign-on URL https://dev-lighthouse.corporate.org.com/sso/saml/ Recipient URL https://dev-lighthouse.corporate.org.com/sso/saml/ Destination URL https://dev-lighthouse.corporate.org.com/sso/saml/ Audience URI (SP Entity ID) https://dev-lighthouse.corporate.org.com/ Provide details by Okta Team Identity Provider Single Sign-On URL: https://org.okta.com/app/org_lighthousedev_1/exk14dabkz9lmSTEq0x8/sso/saml Identity Provider Issuer: http://www.okta.com/exk14dabkz9lmSTEq0x8 X.509 Certificate:okta.cert.txt IDP metadata : IDP_Metadata.txt Metadata.xml <?xml version="1.0" encoding="UTF-8"?><md:EntityDescriptor entityID="http://www.okta.com/exk14dabkz9lmSTEq0x22328" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"><md:IDPSSODescriptor WantAuthnRequestsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"><md:KeyDescriptor use="signing"><ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:X509Data><ds:X509Certificqate>MIIDojCCAoqgAqeqeqewIBqweqweqeAgIGAY9N9lbIMA0GsfsbfhsbfqwyegqyrqywqqCSqGSIb3DQEBCwUAMIGRMQswCQYDVQQGEwJVUzETMBEG .................. 94nXBpszjEGkSxsAJ1HxEzDdVdDcTRa4YIVGPazKIaiNbNgCha8oGQVgJaXv2EkKFgqhcZeQ0Mfq O7jSBH/M2U7QoTMhj0NhUCdy9ZGwt95TPhpJ8HZ6f0Ynqw+TmsPiRJyp8EVgjyv9weHgeuGk81k3 3JNrh0k2UpnGECHngkDJWGRseXr+zg==</ds:X509Certificate></ds:X509Data></ds:KeyInfo></md:KeyDescriptor><md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat><md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat><md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://org.okta.com/app/org_lighthousedev_1/exk14dabkz9lmSTEq0x8/sso/saml"/><md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://org.okta.com/app/org_lighthousedev_1/exk14dabkz9lmSTEq0x8/sso/saml"/></md:IDPSSODescriptor></md:EntityDescriptor> setting.py Django settings for backend project. Generated by 'django-admin startproject' using Django 4.1.7. For more information on this file, see https://docs.djangoproject.com/en/4.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.1/ref/settings/ """ from pathlib import Path from dotenv import load_dotenv import os from .saml2.saml_settings import SAML_CONFIG load_dotenv() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # … -
how do i fix the Method not allowed (GET) error in django version 5 [duplicate]
i keep getting this error in logout.html in django everytime i go to it. Here is the code for the logout.html: <form method="post" action="{% url 'logout' %}"> {% csrf_token %} <button type="submit">logout</button></form> here is my views.py code: from django.shortcuts import render, redirect #from django.contrib.auth.forms import UserCreationForm from django.contrib import messages from django.contrib.auth import authenticate,login ,logout from .forms import UserRegisterForm # Create your views here. def register(request): if request.method == 'POST': form = UserRegisterForm(request.POST) if form.is_valid(): form.save() username= form.cleaned_data.get('username') messages.success(request, f'Account created successfully for {username}') return redirect('login') else: form = UserRegisterForm() return render(request, 'users/register.html', {'form':form}) def logout(request): logout(request) return redirect('login') here is the urls.py code path('login/',auth_views.LoginView.as_view(template_name='users/login.html'), name='login'), path('logout/',auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'), i expected the site to look like this: https://youtu.be/3aVqWaLjqS4?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p&t=970 i am currently following the corey schafer youtube series as shared in the link -
Django settings not reflecting changes [closed]
I have a Django project running on an Ubuntu 22.04 server with Nginx and Gunicorn. After updating the project on my local server, I attempted to transfer it to my cloud server. Using FileZilla, I copied the new files to the server. However, the settings.py file did not update. I made changes to the settings.py file, and then rebooted Gunicorn and Nginx, but the changes did not take effect. I even tried deleting settings.py, but the server still did not respond to the changes. Cache is not enabled. Deleting all the .pyc files did not resolve the issue either. Does anyone know of a solution to this problem? -
How to add custom FileUploadHandler to request in ModelAdmin custom view Django 3.2
I need to add custom file upload handler in admin add and change view (using django 3.2). And getting an error. So far I created custom FileUploadHandler and trying to add to request in my ModelAdmin. Created class in my app\admin.py @admin.register(MyClass) class MyClassAdmin(ModelAdmin): def get_urls(self): urls = super().get_urls() custom_urls = [ url('^my_view/$', self.create_model_view, name='my_view'), ] return custom_urls + urls @csrf_exempt def create_model_view(self, request): request.upload_handlers = [CustomUploadHandler(request)] return super().changeform_view(request) And getting error You cannot set the upload handlers after the upload has been processed. What am i doing wrong? Where request is started processing? -
Django rest framework Status 200 but 'Failed to Load Response Data" On jwt token api
This is the token api of drf jwt. It is giving me 200 but in response it is saying me failed to load data I tried the code in locally it is running in the postman and also the url (https://v2.api.mytask.today/tsauth/api/token/) of server i gave it in the postman it is giving me access and refresh token but in browser it is giving me no response.