Hi all,

Before submitting a bug I'd like to be sure that it hadn't been done
intentionally, here is the issue:

I had a model with two GenericForeignKeys which where defined like that:

class Foo(models.Model):
    item = generic.GenericForeignKey(ct_field="item_content_type",
fk_field="item_object_id")
    item_content_type = models.ForeignKey(ContentType, related_name="item")
    item_object_id = models.IntegerField()

    step = generic.GenericForeignKey(ct_field="step_content_type",
fk_field="step_object_id")
    step_content_type = models.ForeignKey(ContentType, related_name="step")
    step_object_id = models.IntegerField()

It works but now I want to retrieve my Foo object from the Bar model
for example:

class Bar(models.Model):
    foo = generic.GenericRelation(Foo)

Here I can't access the foo attribute from a Bar instance because the
GenericRelation do not seemed to handle specific ct_field and fk_field
in GenericForeignKey. I suspect this part of the GenericRelation's
code with hard-coded "object_id" name:

self.object_id_field_name = kwargs.pop("object_id_field", "object_id")
self.content_type_field_name = kwargs.pop("content_type_field", "content_type")

Any thought before I hack my django in order to find a patch?

Regards,
David

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to