Category "django-views"

Same queryset evaluation code, different field names in Django Views

I have seemingly redundant code in Django Views which evaluates the same query-set (Model.objects.all()) but with different field names: def overview_view(reque

How can I print the url to the order id field of my django form?

I am doing a simple form site with Django. This is what my sites url is looks like: mysite.com/register/12345678 I want to print the part after the register (12

Terminate previous Celery task with same task id and run again if created

In my django project, I have made a view class by using TemplateView class. Again, I am using django channels and have made a consumer class too. Now, I am tryi

Python Django error "Select a valid choice. That choice is not one of the available choices."

I am relatively new to Django so I am likely doing something obviously wrong but I cant seem to figure out what exactly. I have a model called Report and this h

get_object_or_404 and .get(id=pk) is not working when i try to access my model in to some view

i'm trying to access my model using both method but one of them is not working in my view. i want when a user click on {{question.title}} in my home page to be

Django Form processing files

So I have the following code: # the view class UpdateDateView(LoginRequiredMixin, UpdateView): model = Date form_class = DateForm template_name = '

Django processing form input name

I have changed the input's name attribute to some custom name, but the view calls form_invalid method. Why my Form isn't saving (validating)? html: <tr>

Queryset filter to filter response that exactly contains the value as substring in django views

I have created filters that filter API responses, if the response contains at least one letter in the value as substring, I need to create a filter to filter re

send template data from signal in django

As soon as the django user_logged_in signal works, I want to send data to my template at that moment.I need to check if my signal is working. from django.contri

How to display extra context and form fields at the same time on django template using class based view?

I am trying to display some extra context on the page, but when I adding get_context_data method it is displayed context but not a forms fields. This is because

Move HTML variable through views to python script in Django

While working in Django I am trying to take a variable from HTML input, pass it to views.py for some decision making, then pass it from views.py to a separate p

How do i use Data from other model inside forms that is made with other model in django?

right now my template looks like this I wish to use those cards as the choices in the form that is on the right side. i am a newbie so i cant figure out how. is

POST HTML FORM verificaton doesn't work with Django

I am currently learning Django,I connected my register FORM with my views.py, and wrote a little backend code, the problem, is that it links successfully with m

django if user.is_authenticated not working but login user

my problem is that the login operation is done correctly and the session is set up correctly, but user.is_authenticated does not work. The point is that it work

Django complete form as signed up user

After you sign up, you are prompted to a page that contains a form used for gathering additional information about the new user and after that it redirects you

Create view to save data in django m2m parent and intermediate (through) table using a form and formset

I want to replicate the admin functionality shown in the screenshot below on the client side. This is app is meant to cost a recipe based on the ingredients and

Django Framework : Problems with views settings

im learning Django framework and having some issues that i dont get it. Actually i have apps like Polls/ Blog/ and my homepage/ installed and working as i want

NameError! I am following Django tutorial in part 5 when try to run test, getting error

[enter image description here][1] [1]: https://i.stack.imgur.com/2wDSL.png NameError! I am following Django tutorial in part 5 when try to run test, getting e

filter API response based on URL parameters that both exactly matches and also the substring of the parameter matches in Django

I need to filter API response based on URL parameters that both exact match and also the substring of the parameter matches in Django. The API call would be : "

How to remove extra puncuation marks during saving forms data in django?

when ever i add data to the form i got extra puncuation marks in the value as shown in the image. for example - name = xyz while saving i get name = ('xyz',) Th