Questions tagged as 'django-models'

1
answer

How to relate an 'Object' to several 'Objects' Foreigkey

Asking for your support again, I am making an application to inventory the electrical and optical ports of various equipment, and it is not clear to me how to relate a model with several models. I have the following two objects: class ITarj...
asked by 20.08.2016 / 11:59
1
answer

SQL query to DJset's queryset

I have the following SQL query: SELECT DISTINCT ON (e.id) e.id, e.nombre, e.apellido, e.estado, e.documento, c.nivelado, s.nombre AS semestre, t.nombre AS tipo FROM estudiante e JOIN caracterizacion c ON c.estudia...
asked by 21.11.2018 / 07:04
1
answer

Storing ManyToMany fields in a forms.ModelForm form

I am building a form based on some models in one of which I have attributes with ManyToMany relationships to others. The situation is as follows: Model CorporalSegment class CorporalSegment(models.Model): SEGMENTO_HOMBRO = 'Hombr...
asked by 19.07.2016 / 04:47
0
answers

REST API - Serialized models do not take hostname from the production server - Django REST Framework

I am exposing an application (at the moment it is only your user scheme) with Django Rest Framework, and it happens to me that every model that I have serialized, in the url attribute, I have is the address of the localhost of my development mac...
asked by 20.02.2016 / 19:15
1
answer

Error saving ForeingKey with Post_save in User profile

I am creating the user profile with post_save signal , but I have a field foreign key that It's not being saved, and I do not see any way to solve it. I did it like this: All this from the django admin.    The error is: 1048, "Column...
asked by 13.10.2016 / 17:22
2
answers

Update field OneToOneField - Djando rest framework

I have a model called worker class Worker(models.Model): name = models.CharField(max_length=300) code = models.CharField(max_length=100) user = models.OneToOneField(User, null=True, blank=True) def __str__(self): ret...
asked by 14.04.2018 / 18:40
2
answers

Display images from a database in Django

I have a model that has an image field, at the beginning the image was shown, but after I made a few changes but without changing the code that serves the image now it does not work, I have tried everything but it does not work, this is the code...
asked by 17.10.2017 / 15:53
2
answers

Reverse Queryset on Django models

I'm trying to access a model in reverse. To access the Vale model by consulting the model DetailVale is as follows: val= DetalleVale.objects.filter(vale__usuarioVale=usuario).filter(vale__statusFinalizado=1) However I need to consult about...
asked by 06.02.2018 / 22:14
2
answers

Filter ages django

Good afternoon friends, I am creating an app in Django 1.10 and I have a model where the basic data of the people will be stored, this model includes a dateNaciento field, in this model create a method which calculates the age of the people ....
asked by 14.05.2017 / 00:40
1
answer

consultations on django models

I have a problem that I do not know how to solve it. I have three models in my app: class Hecho(models.Model): codigo = models.CharField(max_length=1) hecho = models.CharField(max_length=100) class Beneficiario(models.Model): tipo...
asked by 14.03.2017 / 03:19