#11018: Generic foreign keys in custom m2m relationship model
------------------------------------------+---------------------------------
Reporter: Alexandr | Owner: nobody
Status: new | Milestone: 1.2
Component: Database layer (models, ORM) | Version: 1.1-beta-1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
In version 1.0.2 and older we can use custom table for ManyToManyField
with parameter through = MyRelationModel. MyRelationModel should include
foreign keys. I want to use generic foreign key as one foreign keys:
{{{
class SomeModel(models.Model):
marks = models.ManyToManyField(to=Mark, through=MarkedItem)
class MarkedItem(models.Model):
mark = models.ForeignKey(Mark)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type',
'object_id')
}}}
Example: content object as one of foreign keys.
But this code is't work.
--
Ticket URL: <http://code.djangoproject.com/ticket/11018>
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
-~----------~----~----~----~------~----~------~--~---