Changes between Initial Version and Version 3 of Ticket #24201


Ignore:
Timestamp:
Jan 22, 2015, 12:45:52 AM (10 years ago)
Author:
Alex Hill
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24201

    • Property Has patch set
    • Property Patch needs improvement set
    • Property Needs tests set
    • Property Needs documentation set
  • Ticket #24201 – Description

    initial v3  
    66
    77This is easily solved if you're OK with sprinkling details of the GenericForeignKey implementation in Django core: you can just try `attname`, and if that fails, filter on GFK's `ct_field` and `pk_field`. But maybe a better idea would be to introduce a method on field-like things returning a dictionary of filter parameters matching a given object, or else a property returning a sequence of (filter name, attribute name) pairs from which the filter parameters can be constructed. In the latter case, regular fields would return `((self.name, self.attname),)`, and GFKs would return `((self.fk_field, self.fk_field), (self.ct_field, self.ct_field))`.
     8
     9Here's a branch illustrating the necessary changes: https://github.com/AlexHill/django/compare/order_wrt_gfks
Back to Top