Questions tagged as 'django-forms'

1
answer

Django forms does not display the form fields when using {% include%}

I have been trying for several days to find the answer to this problem. I have tried with the solutions suggested in the threads that I found in which other users had something similar, but none has worked so far. I created a contact form fol...
asked by 25.02.2018 / 12:18
1
answer

How do I insert a ForeignKey field into a model?

I do not know what I'm doing wrong look at my model.py I'm using a User extending AbstractBaseUser since I wanted to use the email field as an identifier and not the username that comes with the default in fact delete it. Using the admin works p...
asked by 29.01.2018 / 16:01
1
answer

Empty Label for a field with ModelChoiceField

Hello, I have a form (in django 1.8) with a field that uses a ModelChoicefield class MyForm(forms.Form): ... campoA = forms.ModelChoiceField( queryset=ModeloB.objects.values_list('campoA__name', flat=True).distinct(), l...
asked by 18.10.2017 / 22:52
1
answer

Avoid repeated objects in the django database

I have a page that has a form where people can put a name, and create a profile. The problem is when several people try to put the same name, since it gives this error get() returned more than one Person What I'm trying to do is to avo...
asked by 04.08.2017 / 23:06
1
answer

Add reddit / hacker news style votes in Class Based Views

I would like to add something similar to the voting system that many web pages have like StackOverflow, Reddit, Hacker News, etc. I wanted to create a button to do this task in the main template that I have, trying to create a FormView bu...
asked by 06.09.2017 / 23:39
1
answer

Place Materialize CSS to FileField - Django

I am trying to use the File_CSS from Materialize but I can not find a way to make it work for me. This is my model: class ComprobanteDomicilio(models.Model): alumno = models.ForeignKey(Alumno, on_delete=models.CASCADE) url_documen...
asked by 30.04.2017 / 09:52
1
answer

How to stop loading by default the records of a form with a foreign key type field in django?

I have a SALES form with a field of type foreign key of CUSTOMER, and I have converted it into a search engine that field on the client side, but django by default it loads all the existing records of the clients in a SELECT , and if ther...
asked by 30.04.2017 / 19:05
1
answer

Pass value of Dateinput to variable in Django

... I'm a bit of a rookie in this django, I know how to do this kind of javascript queries, yii, jquery but in django it's a bit complicated for me. Creating a search by range of dates, because I want to keep track of income for weeks, mont...
asked by 06.04.2017 / 18:52
1
answer

How to show text in Select list of Form EN django type 'placeholder'

I would like to add a default text to the select list as well as the 'placeholder' of a TextInput, but I do not get it, here in the form I have the widgets: 'specialty': forms.Select (attrs = {'class': 'form-control', 'placeholder': 'select y...
asked by 22.02.2017 / 14:57
1
answer

Upload Form Django Error (invalid literal for int () with base 10)

I have a form with which I want to make an "insert" in one of the models and it gives me the following error and I am not able to know why or debug: invalid literal for int () with base 10 views.py def poiUploader(request): title...
asked by 11.10.2016 / 13:29