Category "django-forms"

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

How can I display data from django model and save at the same time using class based views?

I am creating a quiz app using Django. The requirements are: I need to first display all the topics available for the quiz on the homepage. Clicking on a partic

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

how to make custom form without database - DJANGO

So i want to upload file but only sent to locals storage NOT DATABASE too. But i don't know how to make custom forms. suddenly, here's my models.py : from djang

django get the value enside formvalid

I am trying to obtain the value of the val variable that is inside form_valid but I cannot obtain it. Does anyone have any idea what I'm doing wrong? class Coti

Django How to Upload an Image to Form

This is my code associated with the form: # models class Date(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) place

Why does django wizard form not submit when one form is passed through get_form function?

I'm creating an app containing 3 multiple choice questions. The second multiple choice options are dependent on the response to the first question. To accomplis

button function doesn't work without any error - django

So i want to make models form to upload file mp3. I was copy the code from website, but suddenly it's not work. there's no error message in terminal or console

Is it possible to use/test a value of Django's BooleanField without a model?

I'm trying to make a workflow where the user enters data on one page, then has to check the data and tick a tickbox to accept the T&C's. So the code has to

Forbidden (CSRF token missing or incorrect.): /

So i want to make models form to upload file mp3. I was copy the code from website, but suddenly it goes error. Here's error message on the website : Forbidden

ManyToMany Relationship between two models in Django

I am trying to build a website that users can add the courses they are taking. I want to know how should I add the ManyToMany relationship. Such that we can ge

Why should I set max_length when using Choices in a Django model?

In the official Django 2 tutorial I found this: from django.db import models class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR

Is it possible to submit multiple forms at once using Django views?

What I want to accomplish is to be able to submit multiple forms contained on one page. What I have currenlty done is supplied a view that returns 8 forms. Is i

nothing happens when submitting django form

I have a problem with django forms, when submitting a form nothing seems to happen, even the server didn't get any response except GET request to view the form

Enable post of HTML form to Django database backend

I'm trying to write the code to enable form data to be sent to the backend database. The form is just a few fields, name, website, and portfolio address created

Django form with two submit buttons . . . one requires fields and one doesn't

I think this should be a fairly straightforward question . . . I have ONE Django form with TWO different submit buttons. The first submit button is just for SAV

how to pass extra custom attribute in Django template from "select option" form to a view

I have an html form include a select input in Django template, and the option has an extra attribute value called "testvalue". I want to pass the "testvalue" at

Only accept 2 digits integer array in django model form

How to make a form field that accept 2 digit numeric array in frontend. if someone enter more then 2 digit or string then The input value is automatically valid

Python(Django) :I want the payment form(code) triggered whenever a user clicks the submit button and only saved into DB if payment is succesful

I am currently using DJANGO How can I make the payment form(code) triggered when a user clickn submit and also make it saved into DB after successful payment. P

How to remove the choice field based on relationships between instances in the database in Django

I'm new to django and I would like to ask a question about a case that I can't solve if for example I have many categories, in these categories I can have one o