Questions tagged [django-views]
Django views are MVC views; they control rendering (typically through templates), and the data displayed.
django-views
24,384
questions
0
votes
0
answers
13
views
Handle Http 302 response on Django view and Javascript async function
For strict security, how can I implement redirect on Django view in response to a JS async call that only updates a div InnerHTML? That is the first preference.
I tried JS client-side redirect in ...
0
votes
1
answer
21
views
Incorrect redirection to login page from profile and logout links after user login
Context
I'm working on a Django project where I have implemented user authentication with profile and logout functionality. The issue I'm encountering is that when I try to access the profile or ...
0
votes
0
answers
18
views
Retrieving image with javascript to display Django
I am trying to retrieve an image via Javascript function that calls a function from my views that has the image. I need help with populating the image:
Views:
def view_company_logo(request):
print(...
0
votes
1
answer
50
views
Django Postgresql ORM optimisation
I have a PostgreSQL view called view_sales_dashboard - this consists of several millions rows of daily sales data.
In the Django view I want to present a table grouped by the products, with the ...
0
votes
0
answers
34
views
How to get form file data rendered in form invalid cases in django
i have defined a form in django as :
forms.py
@parsleyfy
class CreationForm(forms.Form):
sample_name=forms.CharField(label="Agent Name",max_length=40, widget=forms.TextInput(attrs={'...
0
votes
1
answer
23
views
How can I have a different method instead of user.is_authenticated? [duplicate]
I have an academy website , which has 3 different kinds of users. The first one is the staff that I handle with the admin panel. The second one is parents or people who are going to get some ...
0
votes
1
answer
15
views
PUT metod make the password field are required and when i put the value in fields its save it as a text in th database with no hash
views.py
from .serializers import CreateUser,ShowUser,MeSerializer,ChangePasswordSerializer
from rest_framework import viewsets
from django.contrib.auth.models import User
from rest_framework....
-1
votes
0
answers
65
views
Django for loop not working in HTML in Django 4.2
HELP: There is some issue with for loop in my code. I cannot find the problem. This problem is not displaying data from backend. Can you help me with it? Whole code and process is given below.
Models:
...
0
votes
0
answers
14
views
PDF not generated from Django template
I am working on a form where I need to pass the user inputs into a context which is then passed to Django template which should be converted to a PDF file. However, instead of getting a PDF attachemnt ...
0
votes
1
answer
20
views
Entries not showing on page
Cant seem to figure out why my entries from my database are not appearing on my page but my topics name on the entry page is
I'm trying to show show entries from my database on a page, the link to the ...
0
votes
1
answer
35
views
TemplateDoesNotExist at / (Django)
Trying to my create a home page, with django. I keep running into a TemplateDoesNotExist at error.
Im pretty sure it has something to do with my paths set up. I havent worked with django enough to ...
0
votes
0
answers
16
views
how to send content from celery task to websucket
please i am trying to process some data in a celery task and pass it to websucket connection to the clientside but the bellow code deosnt seam to be doing what i intend to achieve .
Consumers.py file
...
0
votes
0
answers
29
views
Manager isn't available; 'auth.User' has been swapped for 'main.User'
I had to recreate User model. I have added custom phone and zip_code fields to the model. But I am encountering Manager isn't available; 'auth.User' has been swapped for 'main.User' error.
This is my ...
-1
votes
0
answers
30
views
My django form keeps giving me the error message even though i still get the data i'm trying to send in the database, what could be wrong? th
I'm trying to add a staff with django everything seems to be working fine i even see the entry in the database but once i click the submit button instead message.success i get message.error i cant ...
0
votes
0
answers
43
views
NOT NULL constraint failed on PUT request in Django [duplicate]
I'm new to Django and I'm having trouble handling form-data and raw data in PUT requests. I need to update records of a Person model via a PUT request. The Person model has several fields including ...