summaryrefslogtreecommitdiff
path: root/app/pages/admin.py
blob: e1328e9c976de4c0b531d9cffc9f5eb3ffb25589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from django.contrib import admin
from django import forms
from pages.models import Page
from django.conf import settings

from django.forms import TextInput, Textarea
from django.db import models
class PageAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': Textarea(attrs={'rows':25, 'cols':40})},
    }
    list_display = ('title', 'slug',)           
    search_fields = ['title', 'body_markdown']
    prepopulated_fields = {"slug" : ('title',)}
    fieldsets = (
        ('Page', {
          'fields': ('title','body_markdown', 'slug'), 
          'classes': ('show','extrapretty','wide')
          }),
        ('Metadata', {
            'classes': ('collapse closed',),
            'fields': ('meta_description',), 
        })
    )
    
admin.site.register(Page, PageAdmin)