django-admin-sortable/adminsortable/fields.py
Brandon Taylor 37f91cce97 Added SortableForeignKey field to replace sortable_by model property.
Refactored how the sortable_by properties get populated by looping over the model fields until we get to the SortableForeignKey, then grabbing properties from the field and its related data.
2012-02-24 22:35:30 -06:00

9 lines
318 B
Python

from django.db.models.fields.related import ForeignKey
class SortableForeignKey(ForeignKey):
"""
Field simply acts as a flag to determine the class to sort by.
This field replaces previous functionality where `sortable_by` was definied as a model property
that specified another model class.
"""