django-typed-models
django-typed-models copied to clipboard
polymorphic django models using automatic type-field downcasting
`django-admin makemigrations` gives these errors when you add a `Meta.indexes = [...]` on a base model: ``` myapp.SpecificThing: (models.E016) 'indexes' refers to field 'permissions' which is not local to model...
One limitation of this library as written today is that it reserves `type` as a field to hold the model type. When migrating an existing codebase in which `type` is...
Let's say we will have code like that in migration: ``` ChildModel = apps.get_model('app', 'ChildModel') ChildModel.objects.create(field='a') ``` The instance of parent model is saved in DB with `type` field set...
Since choices doesn't have a truthy value, `django.db.models.fields.Field` doesn't add the `get_FOO_display` ([code](https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L745), [docs](https://docs.djangoproject.com/en/2.1/ref/models/instances/#extra-instance-methods)) which in this case would be `get_type_display`. IMO this is a Django bug (I'll file a...
Hi there, I am just wandering, would it be (theoretically, I see it is not possible right now) possible to use same names for fields in derived classes if each...
I tried to use an AbstractBase class which uses TypedModel, but this fails: ``` class AbstractBase(typedmodels.TypedModel): class Meta: abstract=True ``` ``` File "/home/foo_eins_dtg/src/foo/foo/models/config.py", line 64, in class AbstractBase(typedmodels.TypedModel): File "/home/foo_eins_dtg/lib/python2.7/site-packages/typedmodels/models.py",...
Given this doc-item hierarchy: ``` class BaseDoc(TypedModel): ... class BaseDocItem(TypedModel): doc = models.ForeignKey(BaseDoc) class MyDoc(BaseDoc): ... class MyItem(BaseDocItem): ... ``` and _post_delete_ signal handler for MyItem then: `item.delete()` fires _post_delete_...
There is a central app `core` which defines a class `Plugin` and there is an optional app `my_plugin` which subclasses from `Plugin`. I run `manage.py schemamigration my_plugin --auto`, but `Nothing...
A thread[1] on django-devel showed, that there are fears of single table inheritance. - There is one table which holds all data. - STI reduces the database to key-value store...
If `unique_together` is defined in `Animal`'s `Meta` inner class, it should (but does not) propagate to `Canine`, since `Canine` (being of the same backend database table) is in fact subject...