diff options
Diffstat (limited to 'app/pages/admin.py')
-rw-r--r-- | app/pages/admin.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/app/pages/admin.py b/app/pages/admin.py new file mode 100644 index 0000000..3c7d900 --- /dev/null +++ b/app/pages/admin.py @@ -0,0 +1,55 @@ +from django.contrib import admin +from utils.widgets import LGEntryForm + +from django import forms +from django.forms import Textarea +from django.db import models + +from pages.models import Page, HomePage + + +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 = LGEntryForm + list_display = ('title', 'site', 'slug', 'path', 'app', 'build') + search_fields = ['title', 'body_markdown'] + prepopulated_fields = {"slug": ('title',)} + fieldsets = ( + ('Page', { + 'fields': ('title', 'sub_title', 'body_markdown', ('build', 'enable_comments'), ('site','slug', 'path', 'app'), 'featured_image', 'pub_date'), + 'classes': ('show', 'extrapretty', 'wide') + }), + ('Metadata', { + 'classes': ('collapse closed',), + 'fields': ('meta_description',), + }) + ) + + class Media: + js = ('image-loader.js', 'product-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } + + + + +@admin.register(HomePage) +class HomePageAdmin(admin.ModelAdmin): + form = LGEntryForm + filter_horizontal = ('popular',) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } |