24,274 questions
-1
votes
1
answer
90
views
Django Registration View Not Rendering Template, Returns Minimal Response (71 Bytes)
I'm working on a Django project (version 5.2.6) and facing an issue with the student registration view. The login and logout views work perfectly, but the registration view (StudentRegistrationView) ...
0
votes
0
answers
47
views
Django-Tenant-Users: IntegrityError on permissions_usertenantpermissions_profile_id_key when creating a tenant
I’m using Django with django-tenants and django-tenant-users to manage multi-tenant accounts.
I’m having an issue when creating a new tenant:
When I try to create a new user + its tenant through my ...
0
votes
1
answer
86
views
Django REST API endpoints URL paths
I have a Django 4.2 app with Postgres DB and REST API. My urls.py contains this path in urlpatterns:
path('create/<int:pk>/<str:name>/', ComponentCreate.as_view(), name='create-component')
...
3
votes
1
answer
99
views
Django Pagination with DetailView
I have a library website with a database of books and their copies.
Book and BookInstance have a one-to-many relationship: each BookInstance has a foreign key to Book.
I show detailed information ...
0
votes
1
answer
53
views
How to make DRF use url path as empty and base path?
I am trying to omit the URL path for an action in a ViewSet like
@action(detail=False, methods=['patch'], url_path='')
def update_current_user(self, request):
But when I give url_path as an empty ...
0
votes
1
answer
70
views
CSRF token not set
I was creating my api using django restframework. I am using simple jwt for authentication. The tokens are generated after user login via his/her email and password but before login email must be ...
1
vote
1
answer
46
views
Django Field errors not displaying
Here is my forms.py code:
from .models import User
class userRegistrationForm(forms.ModelForm):
password = forms.CharField(widget = forms.PasswordInput())
confirm_password = forms....
0
votes
1
answer
144
views
How to use login_not_required with class-based views
Django 5.1 introduced the LoginRequiredMiddleware. This comes with the companion decorator login_not_required() for function-based views that don't need authentication. What do I do for a class-...
0
votes
1
answer
35
views
Django - how to process multiple groups of radio buttons
I'm developing a Django project that sets user registrations to is_active = false with activation being controlled by an admin controller. I have a form that lists each un-activated user with 2 radio ...
1
vote
1
answer
56
views
FieldError at /chat/search/ Unsupported lookup 'groupchat_name' for CharField or join on the field not permitted
I'm trying to be able to search chat groups by looking up the chatroom name. I'm using Django Q query...
models.py
class ChatGroup(models.Model):
group_name = models.CharField(max_length=128, ...
0
votes
1
answer
38
views
Django ORM: Error when assigning foreign key instance from CSV import
I have module that responsible for update insurance data
the module job :
takes data from csv
takes the values and validate it and then update
for empty columns within the sheet it will keeps the old ...
0
votes
1
answer
31
views
Error: Django form field is required while content has been entered in the form
View
def work_entry(request):
if request.method == "POST":
form = WorkHoursEntryForm(data=request.POST)
if form.is_valid():
form.save()
return ...
1
vote
1
answer
32
views
Error 'RecordSearchForm' object has no attribute 'is_game'
def index(request):
game_data = GameDataEntry()
update_progress = ProjectProgressEntry()
work_hours = WorkHoursEntry()
if request.method == "GET":
form = ...
0
votes
0
answers
62
views
Issue Updating a Django 1.11.8 Project to Django 5.1.7 — Webpack Loader Error
I've inherited a project initially developed in Django 1.11.8. Unfortunately, the original team left without providing any documentation, and there are minimal comments in the code. I'm currently ...
0
votes
0
answers
49
views
how to pass pk value in the forms and correctly call view.py method , showing a confirmation modal in django
The problem is that i dont see any print or log messages in my views.py , which made me to a conclusion that that method is not method is not being called.
What i want to is to cancel subscription of ...
0
votes
3
answers
67
views
Django MultiValueDictKeyError: 'category' When Submitting Form
'm working on a Django To-Do app, and I'm trying to implement an edit feature where users can modify a task's category and importancy.
I have an edit.html template that contains a form, and when I ...
0
votes
1
answer
47
views
Choices field not rendering in HTML page in my Django project
I have a model with 3 Charfields with choices, I am struggling to render the choices in my html page. On the html page, I had a card color coded between 3 colors. Instead of rendering based on ...
0
votes
1
answer
64
views
Django form won't send post request
Hello I'm rebuilding my inventory application with the use of django forms and jinja template syntax I can't get the form to send a post request.
here's my form in the template
{% extends "...
2
votes
2
answers
127
views
request.method == POST equaling true in next function causing it to run prematurely
so i am running this code
def login_or_join(request):
if request.method == "POST":
option = request.POST.get("option")
print('post request recieved')
...
0
votes
0
answers
50
views
Django access to ModelMultipleChoiceField fields values in form view
I'm trying to create a form that retrieves all objects for one table (students) in the database and let the user select which one of them they want to pick to send an email.
Right now I'm not able to ...
0
votes
1
answer
51
views
How do I pass data from 2 datasets to a Django view?
I have a simple Django project that consists of 3 datasets: Members --< mem_ev >-- Events such that any Member can go to any number of events and any event can have many members (ie a classic ...
2
votes
1
answer
88
views
Unable to Redirect to Next Page After Successful Login in Django
Despite entering the correct credentials, I am consistently redirected back to the login page instead of being granted access to the Products page. This issue persists even though the credentials are ...
1
vote
1
answer
43
views
Best place to initialize a variable from a postgres database table after django project startup
I have a django project where I have some database tables.
One of the database tables is designed to store messages and their titles. This helps me to create/alter these messages from my django-admin.
...
0
votes
1
answer
118
views
HTMX Form in Django: Errors not updating in the DOM after failed validation
I am using HTMX with Django to submit a contact form without refreshing the page. When the form has errors, my backend correctly returns the contact_messages.html template, but the errors do not ...
0
votes
1
answer
106
views
Issue with Django Login Form: Form is Invalid Despite Correct Credentials
I've been facing an issue with my Django login form. Despite providing the correct credentials, the form consistently returns as invalid. Here’s a detailed description of my setup and the problem I’m ...