#15184: Error when subclassing models.ForeignKey field --------------------------------------------------------+------------------- Reporter: rupa108 | Owner: nobody Status: reopened | Milestone: Component: Database layer (models, ORM) | Version: SVN Resolution: | Keywords: ForeignKey, models, subclassing Triage Stage: Accepted | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | --------------------------------------------------------+------------------- Changes (by russellm):
* stage: Unreviewed => Accepted Comment: Ok - I'm going to mark this accepted -- line 96 of subclassing.py looks like it should be field.attname, not field.name. There may be other problems involved with subclassing ForeignKey that follow on from that fix; that will require some additional investigation. However, I would make two comments: 1. When reporting a bug, you need to give us *all* the information you have, not just the bits you want to give us. Nowhere in your mailing list posts or in this ticket did you mention that you were using to_python. That's a pretty important detail for anybody that wants to reproduce the problem. Remember, if we can't reproduce your problem, the problem effectively doesn't exist. 2. The reason you've found this bug is that you are almost certainly Doing It Wrong (tm). Your model layer shouldn't care whether it's being used for AJAX or not. A foreign key is a pointer to another model. The "value" for that model is something that uniquely references another object. A primary key value (or, by proxy, a Django object that encapsulates that primary key value) is the most sensible representation of that value. The need to be "AJAXified" is a display level concern. AJAX rendering considerations should be in your forms/templating layer, not your data model. -- Ticket URL: <http://code.djangoproject.com/ticket/15184#comment:3> 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 django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.