Skip to main content

Questions tagged [django-forms]

Specific questions related to forms within the Django web framework.

0 votes
1 answer
17 views

How do I pass request to a form in test

I am trying to pass request to a Django form in unittest. This is my test: def test_AddPairedStudyForm(self): self.client.force_login(self.user) request = RequestFactory().get(reverse("...
HenryM's user avatar
  • 5,723
-1 votes
1 answer
39 views

Django Topic dropdown displays Topic object(1) but not the name of the object [duplicate]

Django Topic dropdown displays Topic object(1) but not the name of the object class Topic(models.Model): """A topic the user is learning about.""" text = models....
Dokkaebi's user avatar
0 votes
1 answer
44 views

How to Avoid Duplicate Validation When Creating Django Model Instances Manually and via Forms?

When I create new instances using forms, I know that calling is_valid on the form automatically runs the full_clean method for validation. After that, I just call save on the form. But when I create ...
3qu1n0x's user avatar
1 vote
1 answer
31 views

'AnonymousUser' object has no attribute '_meta' in Login view

with custom AuthenticationForm get error when trying login with a non-existent account but when use existent account error dont raise File "C:\python\CTFp\.venv\Lib\site-packages\django\utils\...
Pikabo's user avatar
  • 13
0 votes
0 answers
70 views

Understanding sync_to_async method in Django?

I have never worked with asyncio and/or asynchronous methods with django and am having a little difficulty understanding. I am trying to convert a synchronous utility function (create_email_record) ...
master_j02's user avatar
-2 votes
0 answers
22 views

Interact with inbuilt django DB in python files [closed]

I have a form that needs to interact with the DB inbuilt into django. How would I do that in my forms.py file. Do I just use the default sqlite3 built into python or does django have a different way ...
Pratyush bindal's user avatar
-1 votes
0 answers
23 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 ...
Okereke Chima Emmanuel's user avatar
-4 votes
0 answers
45 views

Logout Process in Django and " Url Logout next" Parameter Error

I am creating a blog page using Django where users can log in and out, write, and share blog posts. After logging in, users should be able to add blog posts, and if they are not logged in, they should ...
BahriDgr's user avatar
0 votes
0 answers
22 views

Accessing 'self.user' or 'self.user_id' in Django model's clean() method

I need to know if this is possible in a model's clean or save method (ideally clean), without using forms, as I want specific validation logic to be directly tied to the model so that both forms and ...
maxipaddy's user avatar
1 vote
1 answer
14 views

Attribute Error, 'WSGIRequest' object has no attribute 'get' Django-HTMX

I'm building a homepage that includes a contact-us form. This contact-us form element should be reusable across multiple pages, so I've used HTMX to try incorporate. However am receiving the following ...
Heartthrob_Rob's user avatar
1 vote
1 answer
19 views

Making a @property.setter an editable field in Django Admin Inlines

Documenting my solution here, maybe someone will have a better idea. In my current project, we have a calculated @property displaying a value based off criteria from other fields. Up until this point ...
FloppyDisco's user avatar
0 votes
0 answers
44 views

Django return "You are not allowed to perform this action." when creating a new entry

I have an application which i want to run scripts. Those scripts are stored in a database. This is how i do all of this using Django 5.0.1 : First of all, this is my settings file : #... ...
helgag's user avatar
  • 13
0 votes
0 answers
16 views

django-admin startproject coredj File "<stdin>", line 1 django-admin startproject core SyntaxError: invalid syntax what's problem here?

Whenever I am firing django-admin startproject core this command it throws me syntax error. I am using python version3.11 and django version in 5.0.6. I am trying to create this in my E:drive and I ...
Pandey's user avatar
  • 1
0 votes
1 answer
28 views

How to send user ID through forms

I want to display the information in the profile section after receiving the information from the user But I can't submit the user ID through the forms My Models: class PersonalInformation(models....
mobin's user avatar
  • 35
0 votes
0 answers
20 views

how to solve UnboundLocalError

I'm trying to export data from database to display it on my django server. I'm still new to django, so I have been following some tutorials. I did exactly what's on the tutorial and I'm still getting ...
Gloria Matope's user avatar

15 30 50 per page
1
2 3 4 5
1348