Refactored order_field_name out of Sortable class, instead deriving from Meta.ordering, since you have to set Meta.ordering to the order field to get the proper Sorting anyway.

This commit is contained in:
Brandon Taylor
2015-09-02 09:38:10 -04:00
parent 74a6cadf8d
commit bee71e6d40
5 changed files with 21 additions and 17 deletions
+1 -5
View File
@@ -24,7 +24,7 @@ class Category(SimpleModel, SortableMixin):
verbose_name_plural = 'Categories'
ordering = ['order']
order = models.PositiveIntegerField(default=0, editable=False)
order = models.PositiveIntegerField(default=0)
# A model with an override of its queryset for admin
@@ -211,8 +211,6 @@ class CustomWidget(SortableMixin, SimpleModel):
custom_order_field = models.PositiveIntegerField(default=0, db_index=True,
editable=False)
order_field_name = 'custom_order_field'
class Meta:
ordering = ['custom_order_field']
verbose_name = 'Custom Widget'
@@ -231,8 +229,6 @@ class CustomWidgetComponent(SortableMixin, SimpleModel):
widget_order = models.PositiveIntegerField(default=0, db_index=True,
editable=False)
order_field_name = 'widget_order'
class Meta:
ordering = ['widget_order']
verbose_name = 'Custom Widget Component'
Binary file not shown.