Questions tagged as 'django-models'

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
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

Error loading file in html form

I am creating an application using django where files should be uploaded and these will be saved in the folder of a project. The problem is that when I fill out the form from the admin of django it allows me to save the file without problem...
asked by 24.03.2018 / 21:55
1
answer

The ManytoMany relationship is not performed

I have the following models : class Persona(models.Model): cedula = models.CharField(max_length=12, unique=True, null=False, blank=False) rol = models.ManyToManyField('Rol') cuenta = models.OneToOneField(settings.AUTH_USER_MODEL,...
asked by 08.09.2017 / 19:34
0
answers

Show in a tab the content of a [closed] model

Good I am trying to show the content of a model in a template, the problem is the following one: I do not know how to do to show the content depending on the option to which you click. Since I am using a for in the template, only the cont...
asked by 31.01.2017 / 15:27
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

Doubt with Models in Django

Hello, I have the following models: class Cotizacion(TimeStampedModel): codigo = models.CharField(primary_key=True, max_length=12) proveedor = models.ForeignKey(Proveedor) fecha = models.DateField() observaciones = models.TextF...
asked by 01.07.2016 / 23:11
1
answer

Problem with login django rest framework

I'm doing an api with django rest framework in which I use token authentication. My problem is that when I get the "username" and "password" parameters of a POST request, I can not identify my user (previously created) This is my code: models...
asked by 10.10.2018 / 17:15
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

What kind of queryset can I do, to order type of strategy in conservative, moderate and risky?

This is my class: class FirFondoDistribucionAdmin(admin.ModelAdmin): """ Administrador de las distribuciones de dichos fondos """ list_display = ('fondo', 'tipo_distribucion', 'porcentaje', 'is_activo', 'fecha') admin.s...
asked by 03.07.2018 / 18:46