884fd4579a
Elements are now ordered by parent and weight. The parent, link and weight are now displayed in the list. fix issue #1
28 lines
735 B
Python
28 lines
735 B
Python
from django.contrib import admin
|
|
from django import forms
|
|
from .models import Element, ElementDescription, ElementSeparator
|
|
|
|
|
|
class ElementDescriptionAdminForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ElementDescription
|
|
widgets = {
|
|
'description': forms.widgets.Textarea,
|
|
}
|
|
fields = '__all__'
|
|
|
|
|
|
class ElementDescriptionInline(admin.StackedInline):
|
|
model = ElementDescription
|
|
form = ElementDescriptionAdminForm
|
|
extra = 2
|
|
|
|
|
|
class ElementAdmin(admin.ModelAdmin):
|
|
list_display = ('__str__', 'parent', 'link', 'weight')
|
|
ordering = ('parent', 'weight')
|
|
inlines = [ElementDescriptionInline]
|
|
|
|
|
|
admin.site.register(Element, ElementAdmin)
|
|
admin.site.register(ElementSeparator)
|