Questions tagged as 'django-forms'

1
answer

How to Choose Grupo django when registering

I would like to know how I can choose the group to which the user belongs when I am creating it, at this moment I can only create users but not define the group to which they belong. VIEWS.PY class RegistroUsuario(CreateView): model = Use...
asked by 10.08.2018 / 23:19
1
answer

Handle a ModelMultipleChoiceField from the views.py

I have this field in my form And I want the views.py to collect all the coins chosen, currently only returns the last one. views.py class userPageView(TemplateView): template_name = 'user.html' def get_context_data(self, **kwargs):...
asked by 07.07.2018 / 13:09
1
answer

Show form in a view based on Django classes

I have the impression that it must be something simple, but I can not do it with CBV's. I try to render a view that shows the content of a post, and at the same time, in the same view, show a form so that comments can be added to it. The first t...
asked by 06.07.2018 / 01:27
0
answers

Modify admin form of Django

Is there any way to modify the structure of a Model's fields in the Django administrator? So that the fields (F000, F001, F010, FO11, F012) are displayed Horizontally     
asked by 26.05.2018 / 19:22
1
answer

UpdateView creates new items in a Formset, does not update them

Two months ago I started using Django. Right now I have the CBV of a form with two elements, a Parent Model and a Child Model that can be multiple. I have functional part of Create, Detail, List and Delete. I have the problem when editing with t...
asked by 16.05.2018 / 10:33
1
answer

How to assign a unique ID to each date-picker field in a form in Django

I'm using django-bootstrap3 (pip install django-bootstrap3) to render forms and django-bootstrap-datepicker (pip install django-bootstrap-datepicker) to apply a calendar widget to DateField fields. In my form, I have the fields...
asked by 15.02.2018 / 00:59
1
answer

Appropriate class view to contain various forms of different objects

I want to do a view with three sections forms for three different objects, Priorities, States and Types to know. I have something like this . I did it using modelformsets , in a list view, but I do not know what kind of view to use to...
asked by 09.10.2017 / 14:39
1
answer

How to generate a 'limit_choices' with the 'id' of a table previously selected in '/ admin'

I am using 'GenericForeigKey' to relate several models to only one, I have the following code: class IPuertoOptico(models.Model): nomenclatura = models.CharField(max_length=30) limit = models.Q(app_label='infrastructure', model='itarj...
asked by 01.09.2016 / 14:43
1
answer

django-crispy-forms - Inserting fields in a template

I have the following form: class RehabilitationSessionForm(forms.ModelForm): def __init__(self, *args, **kwargs): # user = kwargs.pop('user', None) super(RehabilitationSessionForm, self).__init__(*args, **kwargs) s...
asked by 01.12.2016 / 22:44
2
answers

How to use ajax with django forms?

My models.py # -*- encoding: utf-8 -*- from django.db import models from general.models import BaseUnique, BaseTitle, Empresa, Arl from recurso_humano.models import Persona, Sucursal # ===================== HEALTH BASIC ======================...
asked by 25.02.2016 / 06:57