#14217: Fieldname cannot be the same as the Modelname when using model
inheritance
---------------------------------------------------+------------------------
Reporter: willian | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.2
Resolution: | Keywords: model
inheritance, ORM
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by niall):
* needs_better_patch: => 0
* component: Uncategorized => Database layer (models, ORM)
* needs_tests: => 0
* keywords: => model inheritance, ORM
* needs_docs: => 0
* stage: Unreviewed => Accepted
Comment:
The super class has an attribute for each sub class with the same sub
class but lower cased. This behavior is documented in the
[http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-
related-name be careful with related name] section of the model docs. The
child elements will inherit inherit this attributes causing errors when
you try to initialise an instance of that model (it thinks the fields are
all related fields rather than say a CharField).
I'm guessing the models class should check for this and throw an exception
when a field with the same lower case name as a subclass is defined.
--
Ticket URL: <http://code.djangoproject.com/ticket/14217#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.