Questions tagged as 'django'

1
answer

Add, concatenate object to a queryset in django

Today I want to share this solution to add elements to a django queryset def Caracterizacion_estudianteUpdate(request, estudiante_id, caracterizacion_id): caracterizacion = Caracterizacion.objects.get(id=caracterizacion_id) estudiante...
asked by 14.11.2018 / 06:55
1
answer

how to solve two views of the same url (Home) - Django

How is it going? I write because I do not know how to solve the following question in Django (from my condition again in this): I have two apps that must be shown in the same template. That is, they share the url that is the home, and they ha...
asked by 04.11.2018 / 17:48
2
answers

Check in Django a model using ORM?

class Curso(models.Model): fecha = models.DateField() hora_inicio = models.TimeField() hora_fin = models.TimeField() capacidad_maxima = models.PositiveSmallIntegerField(default=6) sede = models.ForeignKey(Sede) profesor =...
asked by 09.03.2016 / 22:53
1
answer

Pager with format 1 2 3

Hello, I'm using the django paginator 1.8 (paginator) works fine, but I would like you to show me the number of my pages in this way I have 21 records that means I have 3 pages and the pager should show: < < 1 2 3 > > but it...
asked by 18.03.2016 / 17:40
2
answers

How to update a float or int field of an entry? - Django

Hello friends, sorry for the inconvenience, but I want to update a Float field in my database but I get errors that can not. My model is as follows: models.py class Model1(models.Model): user = models.ForeignKey(User, on_delete=mod...
asked by 25.08.2018 / 05:48
1
answer

NameError: name 'x' is not defined - Python - Django

I have a code that marks me an error of an undefined variable, but I do not know why. This is my Model: models.py class Model(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) valor = models.Flo...
asked by 30.08.2018 / 06:27
1
answer

Save file to directory, from the view - Django

I have an application with which I upload files, and subsequently those files are consulted; the files have the following nomenclature: EXAMPLE_7777_AAAA.pdf If the file belongs to group 7777, the file is saved in the path: upload_to = 'Files...
asked by 14.08.2018 / 21:08
1
answer

Placing images in the Django project

I want to place an image as a logo within my project and to see it in all my views, but I do not know how and I tried the documentation but I did not understand it well and I do not achieve it. style.css: ody { background: whit...
asked by 06.09.2018 / 15:59
1
answer

How to recover a field from a foreign key, to be used in another form without modifying the field to recover?

I have the following graphical interface Where I want to unsubscribe a product, retrieving the code in the new "Submit Low" form. This is my code Code models.py class venta(models.Model): codigo = models.IntegerFi...
asked by 26.07.2018 / 16:57
1
answer

How to process CSV files with Django, after being imported? [closed]

I need an explanation or orientation of the steps of how to process a csv file, to import it with the FileField field of the Django models but I need the information of the CSV to replicate in the databases. I appreciate your collaboration.    ...
asked by 01.08.2018 / 06:42