Questions tagged as 'django-models'

3
answers

Take a parameter in a url and send it to the model when a form is sent

I have a CreateView view to which I am passing a PK by the URL, what I want to do basically is to take that station and send it to a field of the model with which this view works (the form does not contain the model field to which I want...
asked by 18.07.2017 / 06:45
1
answer

add hours in Django models

I am trying to make a movie model in Django, but I would like to add the duration of it and I do not know how to do it very well in django, I know that you can add date and time with datetime in the models. But I only want an hour of dura...
asked by 15.08.2016 / 15:17
1
answer

Is the migration folder uploaded to github?

I have a question about what I'm uploading to github, it's precisely from the migrations folder, is that folder up? I'm talking about this folder:    myapp / migrations     
asked by 26.10.2016 / 21:07
1
answer

Create a ListView and DetailView with two models

I have 2 models that are related to a OneToOneField , but I do not know how to access the 2 models, my view is as follows: class ListaSolicitudes(ListView): model = Modelo1 #aqui recibe un solo modelo, como uso el segundo modelos...
asked by 07.03.2018 / 18:09
1
answer

NOT NULL constraint failed: django

I'm getting an error when I try to create a new element by a form, trying that the user who is already with the session started can upload an image and it is recognized as his in the relationship with the base of data that I have in models.py...
asked by 29.08.2017 / 06:18
1
answer

Creation of a class in Django that has a key to itself

I'm getting into the world of Django and I was trying to generate different types of models. Now I am creating a model with a class 'Tags' which has a key that calls another object of the class (To create objects linked by relationship)....
asked by 25.04.2016 / 10:59
1
answer

Error importing a model Unhandled exception - can not import name

I have the following structure of my application in relation to the following apps project userprofile models.py rbsessions models.py In userprofile / models.py I have the following from __future__ import unicode_l...
asked by 20.01.2016 / 15:58
1
answer

Regular expression for django url with slug containing "/"

The idea is to create a regular expression to configure the url I have 2 models, category and articles. The article model has a FK to category and the slug makes the join correctly slug (category) / slug (article). I want to use the separator...
asked by 23.08.2017 / 05:13
2
answers

save image in django python

Hi, I would like to know if I can and how to possibly save an image in a folder whose name is entered in the title of the same model, for example: title ="animation" image = this will be stored in uploads / animation / class Imagen(...
asked by 13.06.2018 / 17:01
2
answers

Heritage in Django models

In Django models, when you create a class that inherits from another that is not abstract, for database purposes, it's like creating a one-to-one relationship between the two tables. Starting from the following      example: class...
asked by 15.09.2016 / 13:42