summaryrefslogtreecommitdiff
path: root/app/pages/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/pages/admin.py')
-rw-r--r--app/pages/admin.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/pages/admin.py b/app/pages/admin.py
new file mode 100644
index 0000000..706d690
--- /dev/null
+++ b/app/pages/admin.py
@@ -0,0 +1,32 @@
+from django.contrib import admin
+
+from django import forms
+
+from pages.models import Page
+
+
+class PageEntryForm(forms.ModelForm):
+ class Meta:
+ model = Page
+ fields = '__all__'
+ widgets = {
+ 'body_markdown': forms.Textarea(attrs={'rows': 50, 'cols': 100}),
+ }
+
+
+@admin.register(Page)
+class PageAdmin(admin.ModelAdmin):
+ form = PageEntryForm
+ list_display = ('title', 'slug', 'path')
+ search_fields = ['title', 'body_markdown']
+ prepopulated_fields = {"slug": ('title',)}
+ fieldsets = (
+ ('Page', {
+ 'fields': ('title', 'body_markdown', ('slug', 'path', )),
+ 'classes': ('show', 'extrapretty', 'wide')
+ }),
+ ('Metadata', {
+ 'classes': ('collapse closed',),
+ 'fields': ('meta_description',),
+ })
+ )