Questions tagged [django-forms]

Specific questions related to forms with the Django web framework

0
votes
0answers
5 views

Django admin two step import from Excel with formset-validation on the second step

I have to import some SKU to Order from excel, but I have to show validation form with error-fields and make some changes for fields before save import results. All in Django admin. Here is 2-nd step ...
1
vote
1answer
23 views

User Feedback through Django Email

I have an app, in which the main User adds a sub user and sends him an email. I want the sub user to have a button in the email template that would lead him/her to a Feedback form. That feedback form'...
0
votes
2answers
25 views

How to filter data displayed in a table in django?

I have a project where when a user enters a vehicle no, the database is filtered and a table containing that vehicle no and the information corresponding to is displayed. I further want to filter this ...
0
votes
0answers
4 views

GroupForm object has no attribute 'Delete'

I have a form define and wnat to delete an object of the talbe, My code works before fine and now I have this error :AttributeError: 'GroupForm' object has no attribute 'delete' It refers the error ...
0
votes
1answer
21 views

How to retrieve input data from one form to another form in Django?

I am trying to create an app which create an user with unique id using forms and add that user to a data table . I need to retrieve the field input data from previous form to new form with some new ...
0
votes
0answers
7 views

Assign a widget to ModelForm field after initialization

I have a ModelForm which looks more or less like this one: class SomeModelForm(forms.ModelForm): def __init__(self, *args, **kwargs): user = kwargs.pop('user', None) super(...
0
votes
0answers
17 views

Django inline formset want to auto-save user, but gives IntegrityError

I am having 2 models: Study Request Concept and Comments. Study request Concept can have multiple comments. models.py: class StudyRequestConcept(models.Model): CHOICES = ( ('Yes', 'Yes')...
0
votes
0answers
9 views

Django admin 2.2.2 TabularInline/StackedInline form additional fields

Im working with Django version 2.2.2 Im using django admin site. I have a class called Author and other called Book. An Author can have many Books. I configured book as TabularInline in django admin....
0
votes
0answers
12 views

Get value/state of checkbox for each row in a Django when POST

I want to display a table with : on rows: the date for each weekday (calculate in my views.py) on columns: the Mealselection of an user. I can get value from models and display it : https://i.imgur....
0
votes
0answers
18 views

How to add additional context to a django form widget

the basic Django CheckboxSelectMultiple widget allows for a label and value to be passed through to the template. I want to add 2 additional fields from a model but I cannot work out how, although I ...
0
votes
1answer
11 views

Not able to initialize the hidden fields in django

This is my view: def my_view(request): if request.method == 'GET': form = MyForm(initial={'user': "my_user"}) if request.method == 'POST': form = MyForm(request.POST) if form....
0
votes
1answer
26 views

Why the form return 'Method not allowed' while extending CreateView CBV in DJANGO

I am not sure what is not working correctly here. The CBV CreateView include a form but when I try to click on 'submit' in the template I receive the 'error' Method Not Allowed (POST) forms.py ...
0
votes
2answers
13 views

Signup page always redirecting to login page even if there are errors during signup

I am working on a signup page for users. It is working fine except the process when there are errors in the form introduced. After hitting the signup button, the page redirects to login with a ...
0
votes
1answer
26 views

How to get an object with a form and then send it to the next view using urls?

I'm trying to send an object obtained with a ModelChoiceField into a view via urls and views parameters by I don't think that's the right method. I don't know if I have to use POST or GET method. ...
0
votes
0answers
8 views

Django formtools SessionWizardView repopulating form on validation error

I've a django-formtools SessionWizardView wizard which works fine when all data is input. However, I have form validation going on within each step of the form and if a step is represented I cannot ...
0
votes
0answers
19 views

How to update different queryset objects with a ModelForm in Django

I have two models as follows class Professor(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) faculty_id = models.IntegerField(primary_key=True) name = models....
0
votes
2answers
19 views

My django form is not displaying on the html page

I am trying to create an addform to take input from a user and add it to my model, however, the form is not showing on the page, can someone tell me what I am doing wrong? Here is the code for the ...
0
votes
1answer
29 views

Save and Continue in Django Forms

I have created a django form which at the moment I can only save the POST. Would like to add Save and Add another button in my templates and views function. Has anyone found a solutions. if request....
0
votes
1answer
24 views

Fill data into Model Form Django and pass id paramater in URL Django

I'm trying fill data into model form and load pages with information field of object. However, I get some error and I don't know fix views.py def profile(request, id): user = get_object_or_404(User, ...
1
vote
1answer
15 views

Forloop choices of RadioSelect in Django ModelForm

I have list of choices. I want to get value one by one choice in HTML forms.py class ProfileForm(ModelForm): class Meta: model = UserInfor fields = [ 'gender'] widgets = { '...
0
votes
1answer
12 views

How to get label name from labels in Meta class Django ModelForm

In Meta class, I define label name for fields. I want to get label name, I tried but nothing. forms.py class UserForm(ModelForm): class Meta: model = User fields = ['first_name'] widgets ...
0
votes
0answers
56 views

Django ModelForm shows “Select a valid choice. That choice is not one of the available choices” when I submit my ForeignKey field

I have a form where users can register the name of Cause Construct by selecting from a list of construct. Every time I try to submit, the field raises "Select a valid choice. That choice is not one of ...
0
votes
0answers
14 views

Throw Step Specific Server Error(s) Upon Saving

I am using django form wizard to save a long and complex form. Before moving to next step, I would process the step data - save the data to server using rest api. I would do the saving on each step ...
0
votes
0answers
15 views

Cross-referencing many to many fields not saving changes Django RF

I have two models, which are cross-referencing each other. Here's model.py: class Backpack(models.Model): capacity = models.PositiveSmallIntegerField(default=0), list_of_items = = models....
0
votes
0answers
39 views

Django quiz: Save user's choice and include them in a result

I want users to take a series of questions each with different choices to select from. Then, after the last question a page containing results should be displayed that is based on the user's choices (...
1
vote
1answer
10 views

Why the form is invalid at FormView?

All fields are filled. But for some reason does not go into the form_valid method, but it goes into form_invalid. Why form is invalid? forms.py class CreditFilterForm(forms.Form): ...
0
votes
1answer
18 views

Saving data form in django without editable property for admin-django

I want to save the data of a form that user submit. But I don't wanna the admin be able to edit those data at all. I tried the readonly_field stuffs, but that didn't work. my models.py: class User(...
0
votes
0answers
19 views

How change form_field name in django template?

I tried to get list of checkbox values from template. But I need to change name of form_field in loop like html-input I use forms.ModelForm forms.py is_used = forms.BooleanField(initial=False, ...
0
votes
1answer
18 views

How to add label ID in Django Model Form

I am using Django ModelForm for label. However, I don't know how to add label ID and I find nothings on Internet. UserForm class UserForm(ModelForm): class Meta: model = User ...
1
vote
1answer
28 views

Why are the selected values removed from the multi select in the admin page?

I wrote a multi-select form for the admin page. The selected data is saved in the database, but for some reason it is not displayed as selected (no selected property). When I try to save the object ...
1
vote
1answer
22 views

What is the use of forms.py file and class myform(): in an app when we have CLass Base dViews (CBV)?

As I am new to Django and there is not much information about the use of defining forms.py file with form classes and where are they used. I mean to say that we can do all of the work by CBV, then ...
2
votes
1answer
26 views

Hov can get the translated values in select?

I get select with values Without and With. How can I get already translated values Без and С in django.po in a select? models.py CONFIRMATION_WITHOUT = 'without' CONFIRMATION_OTHER = 'other' ...
0
votes
2answers
32 views

I found an Autocomplete plugin on the web but I do not understand how to implement it in my template

Can you help me with this plugin : https://www.jqueryscript.net/form/Bootstrap-Combo-Box-Typeahead-Plugin-jQuery.html I'm using Bootstrap 3 and I already put the plugin in my static folder. I tried ...
0
votes
1answer
24 views

Django Forms - Validation error shown twice

I want to show up some validation errors for fields in the form: If email already already exists If username is less than 8 characters If passwords don't match If password field is less than 8 ...
0
votes
0answers
19 views

How to move a selected object in a form from one view to another?

I'm new in Django, I hope you can help me. I have a model named Derogation with 3 ForeignKey. I have 2 forms (with each one or two ModelChoiceField) spread across multiple views. In a final view, I ...
0
votes
0answers
12 views

Render page with form have information of 2 tables in database [duplicate]

I had a extended table from User model in Django is userinfo. I created form with list of field: 'first_name', 'last_name', 'date_of_birth', 'gender', 'address', 'phone_number', 'email'. And I had a ...
0
votes
0answers
6 views

value error -didn't return an HttpResponse object. It returned None instead

i am trying to develop a project based on supervisor and clients modules In supervisor pages i want to add an agent registration form ... i created a registration form by importing ...
0
votes
0answers
14 views

How to make ModelForm for User Model validate empty input fields in Django?

So i have a ModelForm created for User model in Django. I have a registration view where this form is being used. However, when I submit the form with some empty fields, the submission works totally ...
0
votes
0answers
12 views

Multiple lists in modelChoiceField in django modelForm

I have a Profile, work, education and current occupation models. Relationship between models, Profile ------- ManytoMany ------ Work Profile ------- ManyToMany ------ Education Profile --...
0
votes
0answers
6 views

A Django form that prevents users from duplicating the records of a model

Am new to Django, and wish to create a form which requires the following inputs to be saved in a particular model: First Name Last Name Date of birth Telephone number Thus, the form will have four ...
2
votes
2answers
32 views

strange data display in select at Django

Already a dead hour I puzzle over a problem with. Why in the first case is SECURITY_WITHOUT displayed, and in the second - display? After all, everything is identical ... In general, in both cases, ...
0
votes
0answers
5 views

Why are fields not rendering when non-field errors exist?

I'm following a slightly out-dated django tutorial but it's good quality material so I'm sticking with it. In this segment on form control the fields are not rendering when there is a non-field error....
0
votes
0answers
12 views

How can I get a form field attribute from within the form element and use it's value to set a nested div's id?

I am new to Django and am struggling with the modelformset. I have read the documentation and looked through StackOverflow, etc. and cannot seem to find a solution to the following problem. I have a ...
0
votes
0answers
12 views

Update view with formset factory not work

I'm trying to do an updateview on a formset but it does not find the data from the second form. in my models.py class OrdemServicoCoroa(models.Model): ordem_servico = models.ForeignKey( ...
0
votes
1answer
22 views

Dynamic form field in Django REST

I'm trying to create a form where the user can create a blog. The form will have a title, one to many authors, and content. For the authors part, I'd like to have an input autocomplete search box (...
0
votes
1answer
29 views

Saving country name from country field

I need country selection field on my form, my models.py: class ContactForm(models.Model): first_name = models.CharField(max_length=10) Country = models.CharField(max_length=10) And my forms....
0
votes
1answer
26 views

Django: Remove form fileds based on some values in the database

I want to remove some fields from a form based on some values in the database. I'm not using this form to insert the data into any database, I'm going to make a csv file from this form data. Also this ...
0
votes
1answer
21 views

How to create sign up form for customer user model in Django?

I have extended the User Model provided by Django into Owner object. What I intend to do, is create a sign up form which creates a new user in my application and also fill up the custom fields defined ...
0
votes
1answer
26 views

Store time stamps to database

I am creating a Django web based application for freelancers ,that they would be paid for number of hours they have worked on a project and also a weekly report is to be generated for weekly work and ...
0
votes
0answers
17 views

How to fetch the data form database by using ajax and sending the data into database in drop down case

I am facing problems while retrieving the data from database in dependent drop downs in django. How to write the views for this template for each field ? I have tried with the traditional techniques ...