django-admin-sortable/sample_project/app/admin.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

22 lines
543 B
Python

from django.contrib import admin
from adminsortable.admin import SortableAdmin, SortableTabularInline, SortableStackedInline
from app.models import Category, Project, Credit, Note
admin.site.register(Category, SortableAdmin)
class CreditInline(SortableTabularInline):
model = Credit
class NoteInline(SortableStackedInline):
model = Note
class ProjectAdmin(SortableAdmin):
inlines = [CreditInline, NoteInline]
list_display = ['__unicode__', 'category']
admin.site.register(Project, ProjectAdmin)