Category "django-views"

I would like to run for loop to each of li tag and want to add content dynamically from django backend admin

I have created a navbar and content can be added from the backend but only the home nav bar shows the icon and the other navbar name is with the same icon. I wa

Django: how to count the ratings and reviews of a post using django?

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

How to deduct funds from users withdrawals in Django Rest Framework

I am building a logistics web application using DRF and i want to set users to withdrawal certain amount, let's say a users withdraw $200, i want the users to g

Detect when user register/Login on Context Proccessor Django

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

Images are not rendering on Django template from a multi-model view

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

Creating Custom Join in Django

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

How to change HTMX behavior to replace the full web page if form is invalid

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

Adding search bar function into a django project

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

The response content must be rendered before it can be iterated over. Django Rest Framework

I have a Cart model and Cartserializers. I am trying to do that is if cart defects exist in the cart and then update the cart by increasing the quantity of cart

How to get foreign key detailed values based on id in html template in django

In Models.py class Interview(models.Model): Current_Date = models.DateField(auto_now_add=True ) User = models.ForeignKey(User,

Dropdown select multiple with HTMX

I am using Django and I am passing some values to views.py via HTMX So Frist I have a dropdown list with multiple choices <select class="custom-select mb

How to mention users using @ in django

I have been working on a project on django and it is very similar to instagram and twitter, one of the functions it needs to have is to mention users using "@"

Using CreateView with 2 Models at the same time

should I be building a function to achieve what I am trying to do?

Django model default value in response

I want to have a default value in my django model response value Sample model query myModel.objects.filter().values("username", "user_gender") I want to have a

django redirect to form view and autofill with previously entered values

I have following scenario. User fills out a form If the user clicks the "continue" button and the form is valid the user will be redirected to a summary view In

Django Assigning or saving value to Foreign Key field

can any one help me with assigning value to a foreign key field. Im trying to create user profile where user can add there countries. when creating the models,

Reverse for 'Profile' with no arguments not found

I'm trying to add user Profile in my django project. i was trying to access user post into the user Profile but its throws an error like this: Reverse for 'Pro

Django AuthenticationForm is not validating and not storing information in database

So basically I'm trying to do a simple login system using Django AuthenticationForm and LoginView. The form takes the user input and when the login button is pr

Django-registration - How to check if email exists in database

During registration currently when a user is entering an existing username and an email it is notified that this username already exists in database. When the u

Django. ''The `actions` argument must be provided when calling `.as_view()` '' when I try to allow DELETE, PUT, ETC

I have to allow delete and update requests from front for my objects of some model. I wish to delete instance and appropriate row in DB. I tryed to use info fr