~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlpoll/admin.py

  • Committer: kaputtnik
  • Date: 2019-05-30 18:20:02 UTC
  • mto: This revision was merged to the branch mainline in revision 540.
  • Revision ID: kaputtnik-20190530182002-g7l91m1xo28clghv
adjusted README; first commit on the new server

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# encoding: utf-8
3
3
#
4
4
 
5
 
from models import Poll, Choice
 
5
from .models import Poll, Choice
6
6
from django.contrib import admin
7
7
 
 
8
 
8
9
class ChoiceInline(admin.TabularInline):
9
10
    model = Choice
10
11
    extra = 10
11
12
 
 
13
 
12
14
class PollAdmin(admin.ModelAdmin):
13
 
    inlines = [ ChoiceInline ]
14
 
    
15
 
    search_fields = [ "name" ]
16
 
    list_display = ["name", "pub_date"]
17
 
    list_filter = [ "pub_date" ]
 
15
    inlines = [ChoiceInline]
 
16
 
 
17
    search_fields = ['name']
 
18
    list_display = ['name', 'pub_date']
 
19
    list_filter = ['pub_date']
18
20
 
19
21
admin.site.register(Poll, PollAdmin)
20
 
 
21