~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlscreens/admin.py

  • Committer: franku
  • Date: 2019-04-10 16:18:40 UTC
  • mfrom: (531.1.5 screens_ordering)
  • Revision ID: somal@arcor.de-20190410161840-29hlbwn3qsbctaa4
allow ordering of screenshots by adding a new column to the tables screenshots; reworked the corresponding admin pages

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from django.contrib import admin
6
6
 
7
7
 
 
8
class ScreenshotsInline(admin.TabularInline):
 
9
    model = Screenshot
 
10
    fields = ('screenshot', 'name', 'comment', 'position')
 
11
 
 
12
 
8
13
class CategoryAdmin(admin.ModelAdmin):
9
14
    prepopulated_fields = {'slug': ('name',)}
10
15
    search_fields = ['name']
11
16
    list_display = ['name']
 
17
    inlines = [ScreenshotsInline,]
12
18
 
13
19
admin.site.register(Category, CategoryAdmin)
14
20
 
16
22
class ScreenshotAdmin(admin.ModelAdmin):
17
23
    search_fields = ['name']
18
24
    list_filter = ['category']
 
25
    list_display = ['category', 'name', 'position']
19
26
 
20
27
admin.site.register(Screenshot, ScreenshotAdmin)