Category "django-forms"

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

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

Django form validation based on custom function that calls api to validate form input value

I've been trying to look around for resources on how to do this, but no luck so far. Any direction would be appreciated! I'm attempting to run a custom function

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

how to change form field from dropdown list to radio button in django if the options in dropdown are being inherited from another model?

i am working on an application where i can select item from drop-down list and buy them. i have a form field which is a drop-down list(items are connected to ot

Why can't I save a custom field to another table?

I'm trying to follow this tutorial: https://simpleisbetterthancomplex.com/tutorial/2018/01/18/how-to-implement-multiple-user-types-with-django.html concerning h

How do I fix the error of my django form not having cleaned_data attribute?

I have this form: class RegisterForm(UserCreationForm): email = forms.EmailField() class Meta: model = User fields = ["username", "emai

How to filter a Django model to display only the logged-in user's data?

Trying to solve this for a week now. How do I filter my model to display only the data assigned to the specific logged-in user? My views.py code below is not wo

Why the html custom form is not working django

I have a contact page with a simple form. Here is views.py: def contact_view(request): if request.method == 'GET': form = ContactForm() else: form = Con

Django: How to return an inline formset with errors

I have created a form to sign up a user by having them create a User object and a UserProfile object as follows: class UserCreationForm(UserCreationForm): c

Django forms.Form reflecting property field constraints

I'm implementing a Django Form witch should contain the field 'fieldA' from modelA: class ModelA(models.Model): fieldA = models.CharField(max_length=8)

Cannot assign "<Invoive: Project>": "Invoive.user" must be a "InvoiveCompany" instance

New in Python code stuffs need a help, Invoices = Parent, Items = Child, I need to add This child items in parent, If i directly save this with the code be

Django form with dropdown list using Database returns empty fields

I'm discovering Django and I'm trying to develop a simple application. I have three tables in my database : One big table to report all the information to users

in Django : Why nothing happens when I try to Create new note with the html form in the notes.html page

I've just started my first app with Django by following a video on YouTube. The app is a students dashboard with 8 tools and features to help the student to mak

Django form_valid method

In my form's view I wonder what if I don't add product_form.save method in the code below and what if I add that: def form_valid(self, form): product_fo

Django form_valid method

In my form's view I wonder what if I don't add product_form.save method in the code below and what if I add that: def form_valid(self, form): product_fo

Auto-submit django form without causing infinite loop

I have an issue on my app that I can't work out the best way to approach the solution. I'm learning Django and have little to no experience in Javascript so any

django django-yearmonth-widget display month as month name

I have used package "django-yearmonth-widget" to have year and month selection and not complete date. Here, day is fixed i.e. 1st of every month. This implement

how to display models.full_clean() ValidationError in django admin?

https://docs.djangoproject.com/en/4.0/ref/models/instances/#validating-objects from django.core.exceptions import ValidationError try: article.full_clean()

django - How to auto-populate existing data in django form while updating

I want to auto populate my update form in django with the existing data, but instance=request.user and instance=request.user.profile seems not to be auto popula