django-admin-sortable/sample_project/app/admin.py
Brandon Taylor b16def5c09 Merged changes from sortable-by-refactor.
Incremented version to 1.2.
Refactored ORM calls to properly order objects by the sortable_by property to ensure objects are grouped correctly in the sortable change list template after being passed through dynamic_regroup.
Fixed missing import for jquery.effects.core, again.
Refactored sortable_by classmethod into a property.
2011-11-22 22:27:20 -06:00

23 lines
595 B
Python
Executable file

from django.contrib import admin
from adminsortable.admin import SortableAdmin, SortableTabularInline, SortableStackedInline
from app.models import Category, Project, Credit, Note, Sample
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)
admin.site.register(Sample, SortableAdmin)