Questions tagged as 'django-forms'

2
answers

Non-mandatory fields using Django Form

Good afternoon I am creating a form to create clients in Django 1.10 using forms that the framework brings. This form brings some fields that are NOT obligatory but at the time of saving it asks me to complete them. How can I solve this? I le...
asked by 28.10.2016 / 23:56
2
answers

How to render the form from the template and see it in admin

I'm using Django 1.11.4, root app url(r'^contacto/', include('contacto.urls'), name='contacto'), contact_app / urls.py from django.conf.urls import url, include from contacto.views import contacto urlpatterns = [ url(r'^$',...
asked by 08.05.2018 / 02:12
1
answer

ImportError at post / new when creating a form with Django

I'm starting at DJango and I have some doubts about the forms, here's the code, I'd appreciate your help: D This is the error that appears: Directories and files: blog |--_pycachce_ |--migrations |--static |-...
asked by 15.01.2018 / 18:23
2
answers

Managing an ImageField in Django - Rendering it in an html template

I have a custom user model in which I want to add a user avatar field: class User(AbstractBaseUser, PermissionsMixin): # email # username # first_name # last_name slug = models.SlugField(max_length=100,blank=True)...
asked by 13.06.2017 / 17:41
1
answer

How to download a file uploaded using a form using FileField

in my model I use a field of type FileField to upload a file using a form. The model is as follows: from django.db import models from apps.agenda.models import TimeStampModel class Evidencia(TimeStampModel): Temas= models.TextFiel...
asked by 11.05.2016 / 03:26
1
answer

Save file to directory, from the view - Django

I have an application with which I upload files, and subsequently those files are consulted; the files have the following nomenclature: EXAMPLE_7777_AAAA.pdf If the file belongs to group 7777, the file is saved in the path: upload_to = 'Files...
asked by 14.08.2018 / 21:08
1
answer

How to process CSV files with Django, after being imported? [closed]

I need an explanation or orientation of the steps of how to process a csv file, to import it with the FileField field of the Django models but I need the information of the CSV to replicate in the databases. I appreciate your collaboration.    ...
asked by 01.08.2018 / 06:42
1
answer

ModelMultipleChoisefield with unique objects from each user Django

I have a user model that has a ManytoMany () field to another object: class PrivateWallet(models.Model): name = ... class Usuario(AbstractUser): private_wallets = models.ManyToManyField(PrivateWallet, blank=True) and I want to crea...
asked by 14.07.2018 / 22:27
1
answer

Placement in MultipleChoiceField template in Django

I'm doing a web page in Django and I want to introduce a MultipleChoiceField in a table. I want to introduce it in a personalized way, but when using the template code it does not give results. Here I leave the codes and the result. forms.p...
asked by 08.05.2018 / 08:59
1
answer

Assign a foreign key from one form to another in django and redirect with reverse_lazy

I have 2 test models, Model1 and Model2. Model2 has the OneToOneField key to Model1, but I can not assign the Model1_id to Model2_id to keep the relationship of the models, I do not know how to access that data from the views.py to assign it in...
asked by 05.03.2018 / 20:33