Questions tagged as 'django-models'

0
answers

Filter initial values of related models

I have the following model in Django: class Employee(models.Model): code = models.CharField(max_length=10, verbose_name='Codigo Empleado', default='N/A') name = models.CharField(max_length=50, verbose_name='Nombre') firstname = models.CharFiel...
asked by 04.12.2018 / 19:50
1
answer

Convert RawQuerySet to QuerySet on DJango

I have the following Code: from django.shortcuts import render from estudiante.models import Estudiante from caracterizacion.models import Tipo, Caracterizacion from .filters import EstudianteFilter # Create your views here. def principal(re...
asked by 21.11.2018 / 07:44
1
answer

Change a field of the parent class in the Django models

I have a parent class where I have an attribute that I want to modify according to the child class: class Service(models.Model): # otros atributos SERVICE_TYPE = { 'None': 'Unknown service type', 'visa': 'Visa', } ser...
asked by 09.11.2018 / 20:53
1
answer

Error too many values to unpack

When I fill out the form, the data stores it correctly in the database, but the form does not work again and the error "too many values to unpack" appears. What can I do? Here is my template: <div class="col-md-20 animate-box">...
asked by 07.11.2018 / 20:43
0
answers

how to open pdf entered into my django database?

I need help My form enters data of documents and the scanned document is attached when I want to open it to see from another form I get this error attached images     
asked by 31.10.2018 / 17:14
1
answer

Know what kind of data I upload in my filefield

It is possible to know what type of data the user is uploading in my one field upload file in a django form, all this in order to do what gmail does. that puts the separated pdf the separated images.     
asked by 31.10.2018 / 15:36
0
answers

How to import models from one folder to another?

the structure of my program is as follows PAP -carpetaP --carpeta1 ---models --carpeta2 ---models In models of folder1 I have some models of tables that I need for the models in the folder2 I've already tried: from folderP.folder1.models im...
asked by 31.10.2018 / 00:04
0
answers

Return Related Model fields in JSON - DjangoRestFramework

I need to be able to access the values of the fields related to a certain model. I have the following in my activity / models.py from django.db import models from metodologia.models import Metodologia from competencia.models import Comp...
asked by 26.10.2018 / 17:14
2
answers

How to add base class to existing django model

I have class A with instances in production, and I want to add a base class B, currently: class A: name = models.TextField(max_length=1000) phone = models.TextField(max_length=30) and what I need is: class B: name = models.Tex...
asked by 19.10.2018 / 19:01
0
answers

Limit quantities in Django database

I am writing to you because I can not find an answer to my problem. I have a small database with the following model from django.db import models class Socio(models.Model): nroSoc = models.IntegerField(primary_key=True, null=False, blank=F...
asked by 12.10.2018 / 17:14