Category "django-views"

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

How to find static files using regex in django in view?

I have django project that has a staticfile with the structure staticfiles/bundles/static/js/main.[hash of 8 random characters].js I want to get the name of mai

How to fix " TypeError: post_details() got an unexpected keyword argument 'slug' "

I'm creating my blog with django, and trying to make posts urls in slug way, after I created the models and called it in views it showed me this error: [TypeErr

Need to do POST method for the Nested serializers using django

models.py class Organisation(models.Model): """ Organisation model """ org_id = models.AutoField(unique=True, primary_key=True) org_name = m

how to change folder location to save file - DJANGO FileSystemStorage

so i want when i upload a file, the file will go to media/mp3 not media/txt. how to change save file location? views.py: def homepage(request): if request.m

TypeError: 'BasePermissionMetaclass' object is not iterable in django rest framework

i looked at other questions regarding this issue and their problems were in the REST_FRAMEWORK = ... values in settings.py file . is there any error in mine ? I

TypeError: cannot unpack non-iterable int object in Django views function

Following is my code in URL.py, views.py and HTML page. However, it returns me the error: TypeError: cannot unpack non-iterable int object. urlpatterns = [

User account delete in django's rest

I want create view which can deactivation user's account. when i create view and send delete request i have error - > "detail": "You do not have permission t

Local Variable 'X' Referenced Before Assignment in Django Views

I am working with Django and trying to create two forms on one page which I am struggling with. I would like to know why I am getting the error "local variable