Questions tagged as 'django-forms'

0
answers

Filter initial values of related models

I have the following model in Django: class Employee(models.Model): code = models.CharField(max_length=10, verbose_name='Codigo Empleado', default='N/A') name = models.CharField(max_length=50, verbose_name='Nombre') firstname = models.CharFiel...
asked by 04.12.2018 / 19:50
0
answers

Error: Enter Valid Date

Someone can help me by solving this error: "Enter Valid date" when entering a date of birth. This I currently have: Settings: DATE_INPUT_FORMATS = ['%Y-%m-%d','%m-%d-%Y','%d-%m-%Y','%d-%m-%y'] Model: fecha_nacimiento = models.DateFiel...
asked by 26.11.2018 / 16:57
1
answer

Error too many values to unpack

When I fill out the form, the data stores it correctly in the database, but the form does not work again and the error "too many values to unpack" appears. What can I do? Here is my template: <div class="col-md-20 animate-box">...
asked by 07.11.2018 / 20:43
0
answers

AttributeError: 'Person' object has no attribute 'get'

Good day community. I have a problem when saving the data of a form of type ModelForm. And it is that when you sent the data of the form to my database the following error appears: AttributeError at /Usuario/ 'Persona' object has no attribute...
asked by 03.11.2018 / 20:59
0
answers

Pass a value to a field

These are my models class Colegio(models.Model): id_colegio = models.AutoField(primary_key=True) nombre_colegio = models.CharField(max_length=100, blank=True, null=True) def __unicode__(self): return self.nombre_colegio...
asked by 02.11.2018 / 15:29
0
answers

how to open pdf entered into my django database?

I need help My form enters data of documents and the scanned document is attached when I want to open it to see from another form I get this error attached images     
asked by 31.10.2018 / 17:14
1
answer

Django local variable 'vaiable' referenced before assignment

Good morning. I could not solve this error "local variable" - 'referenced before assignment ", my code is this: Vista: def palcosSearch(request): if request.method == 'POST': form = SearchPalco(request.POST) if form.is_valid(...
asked by 08.10.2018 / 04:02
3
answers

readonly field django forms

How to make a form field read only (readonly) in django if I have a select in the form type ModelChoiceField , and in the Model it is equivalent to an attribute type ForeignKey been dealing with this but it does not work: class CostoFo...
asked by 17.09.2018 / 18:02
1
answer

django forms does not insert data

I have a form with a model related to several models, create the form and it is well displayed, but when you submit, nothing happens, that is, the data is not saved in the db, I use python 3.7, django 2.0 and mysql: Model class Proyecto(...
asked by 31.08.2018 / 18:18
0
answers

Help with Django Form

I currently have this form to enter patients: class PacienteForm(forms.ModelForm): class Meta: model = Pacientes fields = '__all__' validar= forms.BooleanField(required=False) widgets = { 'nombres': forms.TextInput(at...
asked by 22.08.2018 / 19:07