Questions tagged as 'django-models'

1
answer

Django local variable 'vaiable' referenced before assignment

Good morning. I could not solve this error "local variable" - 'referenced before assignment ", my code is this: Vista: def palcosSearch(request): if request.method == 'POST': form = SearchPalco(request.POST) if form.is_valid(...
asked by 08.10.2018 / 04:02
0
answers

Store documents (jpg, pdf, doc, xls, etc) in DJango database

Hello I want to store documents in the database using DJango, a plugin or method that allows me to convert an image or document to binary to store it in a text field in a database and then can be deciphered to display it again.     
asked by 27.09.2018 / 17:14
1
answer

Upload an image with django 2.0

I need to upload an image in the administration site or in another html page, I have a model which has an ImageField attribute, I need once it is assigned an image to be able to visualize it. Thanks in advance to any help     
asked by 13.09.2018 / 19:42
3
answers

readonly field django forms

How to make a form field read only (readonly) in django if I have a select in the form type ModelChoiceField , and in the Model it is equivalent to an attribute type ForeignKey been dealing with this but it does not work: class CostoFo...
asked by 17.09.2018 / 18:02
0
answers

Edit Choice error in Django Model

I have the following model: class Producto (models.Model): id = models.BigAutoField(primary_key = True) nombre = models.CharField(max_length = 32) estado_rev = models.IntegerField(choices = CHOICES_ESTADO_REV, default = CHOICES_EST...
asked by 11.09.2018 / 11:03
1
answer

Calculate Commissions

I need to calculate the commission a doctor must have for the laboratory tests he sends his patients. In other words, the laboratory pays you for each order sent. Here I have the commission parameterization table: class Comisiones(models.Mo...
asked by 08.08.2018 / 18:48
0
answers

Save in multiple tables in a single post - Django rest frameweok

I have 4 models: class User(AbstractEmailUser): first_name = models.CharField(max_length=100, blank=True) last_name = models.CharField(max_length=100, blank=True) class Event(models.Model): name = models.CharField(max_length=200)...
asked by 04.08.2018 / 19:17
1
answer

Problem when uploading image - Django rest framework

I have 2 models User and EcoUser with a relation of 1 to 1 (I have reduced the fields of the tables for this example): class User(AbstractUser): picture_url = models.ImageField(upload_to='logos/', blank=True) class EcoUser(models.Model)...
asked by 28.07.2018 / 19:18
0
answers

related field in django

When I relate two tables for a common field , in the administration system, it does not return the value of the related field in the table where the value should appear, example .. class t_tlicencia(models.Model): codtlicencia = models.Cha...
asked by 01.08.2018 / 18:19
0
answers

UpdateView problems updating a field

I am trying to make an inventory of tools, with which I can monitor the amount of tools I have, who has them (in which tool carts they are) and a record of the damaged tools. I created a view where I display a list of existing carts or a butt...
asked by 26.07.2018 / 02:36