tagged [django-models]
Connecting a django application to a drupal database?
Connecting a django application to a drupal database? I have a 3 - 4000 nodes in a drupal 6 installation on mysql and want to access these data through my django application. I have used manage.py ins...
- Modified
- 4 May at 12:43
Django ManyToMany filter()
Django ManyToMany filter() I have a model: And I need to contruct a filter along the lines of: It has to be a filter on User and it has to be a single filte
- Modified
- 11 Sep at 00:22
Django - how to create a file and save it to a model's FileField?
Django - how to create a file and save it to a model's FileField? Here's my model. What I want to do is generate a new file and overwrite the existing one whenever a model instance is saved: ``` class...
- Modified
- 22 Sep at 12:49
Django - filtering on foreign key properties
Django - filtering on foreign key properties I'm trying to filter a table in Django based on the value of a particular field of a `ForeignKey`. For example, I have two models: I'd like to filter my
- Modified
- 13 May at 21:13
How to limit the maximum value of a numeric field in a Django model?
How to limit the maximum value of a numeric field in a Django model? Django has various numeric fields available for use in models, e.g. [DecimalField](http://docs.djangoproject.com/en/dev/ref/models/...
- Modified
- 24 Apr at 17:8
How do I create a Django queryset equivalent to a SQL query using the OR operator?
How do I create a Django queryset equivalent to a SQL query using the OR operator? In Django, I know using `filter` with multiple arguments gets translated into SQL `AND` clauses. From the Django Book...
- Modified
- 5 May at 23:28
How can one get the set of all classes with reverse relationships for a model in Django?
How can one get the set of all classes with reverse relationships for a model in Django? Given: ``` from django.db import models class Food(models.Model): """Food, by name.""" name = models.CharFi...
- Modified
- 8 Sep at 00:0
Foreign Key Django Model
Foreign Key Django Model I'm trying to create 3 models ; `Person`, `Address` and `Anniversy`. The plan is to have one address and one anniversy for each person. But each address and anniversy can have...
- Modified
- 20 Aug at 21:25
What does on_delete do on Django models?
What does on_delete do on Django models? I'm quite familiar with Django, but I recently noticed there exists an `on_delete=models.CASCADE` option with the models. I have searched for the documentation...
- Modified
- 26 May at 10:15
Automatic creation date for Django model form objects
Automatic creation date for Django model form objects What's the best way to set a creation date for an object automatically, and also a field that will record when the object was last updated? ``` if...
- Modified
- 29 Jul at 03:55
When saving, how can you check if a field has changed?
When saving, how can you check if a field has changed? In my model I have : ``` class Alias(MyBaseModel): remote_image = models.URLField( max_length=500, null=True, help_text=''' A URL that is...
- Modified
- 10 Jun at 22:56
How to properly use the "choices" field option in Django
How to properly use the "choices" field option in Django I'm reading the tutorial here: [https://docs.djangoproject.com/en/1.5/ref/models/fields/#choices](https://docs.djangoproject.com/en/1.5/ref/mod...
- Modified
- 21 Mar at 20:56
how to import csv data into django models
how to import csv data into django models I have some CSV data and I want to import into django models using the example CSV data: ``` 1;"02-01-101101";"Worm Gear HRF 50";"Ratio 1 : 10";"input shaft, ...
- Modified
- 1 Dec at 09:44
Fastest way to get the first object from a queryset in django?
Fastest way to get the first object from a queryset in django? Often I find myself wanting to get the first object from a queryset in Django, or return `None` if there aren't any. There are lots of wa...
- Modified
- 25 Feb at 23:26
How to express a One-To-Many relationship in Django?
How to express a One-To-Many relationship in Django? I'm defining my Django models right now and I realized that there wasn't a `OneToManyField` in the model field types. I'm sure there's a way to do ...
- Modified
- 4 May at 23:19
Django DoesNotExist
Django DoesNotExist I am having issues on trying to figure "DoesNotExist Errors", I have tried to find the right way for manage the no answer results, however I continue having issues on "DoesNotExist...
- Modified
- 24 Apr at 00:6
Convert Django Model object to dict with all of the fields intact
Convert Django Model object to dict with all of the fields intact How does one convert a django Model object to a dict with of its fields? All ideally includes foreign keys and fields with editable=Fa...
- Modified
- 3 Mar at 16:6
django.db.migrations.exceptions.InconsistentMigrationHistory
django.db.migrations.exceptions.InconsistentMigrationHistory When I run `python manage.py migrate` on my Django project, I get the following error: ``` Traceback (most recent call last): File "manage....
- Modified
- 1 May at 08:14
Django error - matching query does not exist
Django error - matching query does not exist I finally released my project to the production level and suddenly I have some issues I never had to deal with in the development phase. When the users pos...
- Modified
- 23 Jul at 18:5
Django: retrieving abstract-derived models
Django: retrieving abstract-derived models After getting fine answer to my [previous question](https://stackoverflow.com/questions/515145/how-do-i-implement-a-common-interface-for-django-related-objec...
- Modified
- 23 May at 10:27
Django: How to make an unique, blank models.CharField?
Django: How to make an unique, blank models.CharField? Imagine that I have a model that describes the printers that an office has. They could be ready to work or not (maybe in the storage area or it h...
- Modified
- 8 Sep at 19:9