Questions tagged [cleaned-data]

38 questions
1
vote
0 answers

self.clean_data returns None

I have a UserRegistrationForm: class UserRegisterForm(forms.ModelForm): username = forms.CharField(label='enter username', widget=forms.TextInput(attrs={ 'placeholder': 'username', 'class': 'form-control', 'id': 'login' })) email…
gonzo
  • 549
  • 1
  • 8
  • 14
1
vote
3 answers

Django/python: How to pass the form.cleaned_data value to HttpResponseRedirect as an argument?

I wanted to pass an argument (form field value) in an URL as below. But when I do this, it raises an error not enough arguments for format string I would appreciate help me in solve this or suggest me an alternate approach for passing a…
sumanth
  • 751
  • 2
  • 15
  • 34
1
vote
1 answer

Automatically cleaned up panel extjs after sending data

I want to solve a problem with extjs 4. I have a panel with several fields (textfield, textarea, etc.). After sending the data in the database with the "end", I wish all fields were cleaned up automatically and all the events (including events…
Francesco Nigro
  • 479
  • 2
  • 8
  • 20
1
vote
5 answers

formset is valid but returns empty cleaned_data field

I have a formset that returns empty cleaned_data, even though the formset is valid. my view is like this: def edit_files(request): file_formSet = formset_factory(FileUploadForm) if request.POST: formset = file_formSet(request.POST,…
Zeinab Abbasimazar
  • 9,835
  • 23
  • 82
  • 131
1
vote
2 answers

"TypeError: string indices must be integers" when using cleaned_data

The error occurs here: if request.method == 'POST': form = RegisterForm(request.POST) if form.is_valid(): clean = form.cleaned_data username = clean['username'] email = clean['email'] …
user623990
0
votes
1 answer

Django Single Field Validation cleaned_data

I am new in django and I am learning validation topics. Now I have a question about Single Field Validation and cleaned_data dictionary.I run django 3.2. In my model.py there is this table: class Personen(models.Model): DEUTSCHLAND = 'DE' …
mafe68
  • 1
0
votes
0 answers

I am unable to save data from UserForm ( is form name) to database

i Create a model name Details and using this cerate a UserForm . and if i save form then it show 'UserForm' object has no attribute 'cleaned_data' can anyone help me to fix this error , thank you!
0
votes
1 answer

How do you get the DJango form data that were appended?

How do you get all row data of the forms that were appended? I have a form with 5 numbers per row, and some 'N' number of rows that are selected by the user is appended. Form: class locker(forms.Form): num0 = forms.IntegerField(label='',…
itchibahn
  • 79
  • 2
  • 8
0
votes
2 answers

How can I get cleaned_data from html form?

I have django app with class based view and form written in html:
{% csrf_token %}
0
votes
1 answer

How to modify the form filed data?

I have a model: class PastStudy(Model): grade_average = FloatField(null=True) I have a modelform as below: class PastStudyForm(ModelForm): class Meta: model = PastStudy fields = ('grade_average', ) What I have in…
Amin Ba
  • 1,603
  • 1
  • 13
  • 38
0
votes
1 answer

how to receive modelform_instance.cleaned_data['ManyToMany field'] in view when form field is ModelMultipleChoiceField?

Here is the situation: I have a model as below: class School(Model): name = CharField(...) Permit model has three objects: School.objects.create(name='school1') # id=1 School.objects.create(name='school2') # id=2 I have another…
0
votes
1 answer

Cleaned data displays only the last formset data

I have a django project where I am creating a dashboard using django admin and making requests to an API using requests library. I am also using formsets to create multiple forms dynamically. When I make a post request and observe the data using…
Mohnish M
  • 113
  • 3
  • 14
0
votes
2 answers

Python - Django - Form choicefield and cleaned_data

I'm having an issue with how cleaned_data seems to work. I want to store the cleaned_data in a session so I can repopulate the form object later. The problem is my choice fields seems to store the display name of the dropdown not the actual value.…
0
votes
1 answer

Django : Even if my form is valid , I got some fields empty when printing cleaned_data

My model: class sarl(models.Model): denomination_social = models.CharField(max_length=200,blank=True) numero_certificat = models.CharField(max_length=15,blank=True) myfile = models.FileField(blank=True) adresse =…
Elroum
  • 327
  • 1
  • 3
  • 18
0
votes
0 answers

Don't work cleaned_data in Django

This is my code: class HighschoolForm(forms.ModelForm): class Meta: model = Highschool fields = ['id', 'dni', 'name', 'address', 'city', 'country', 'phone', 'mobile', 'mail', 'website', 'contact', 'entrydate'] def…
JuanC
  • 1
  • 2