~widelands-dev/widelands-website/update_beautifulsoup4

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
27
28
29
30
#!/usr/bin/env python -tt
# encoding: utf-8
#

from models import Map
from django.contrib import admin


class MapAdmin(admin.ModelAdmin):
    list_display = ['name', 'author', 'pub_date']
    prepopulated_fields = {'slug': ('name',)}
    search_fields = ['name', 'author']
    list_filter = ['pub_date']
    readonly_fields = ('uploader', 'nr_players', 'w', 'h', 'minimap', 'file', 'world_name')
    fieldsets = (
        (None, {
            'fields': (('name', 'author'), 'uploader', 'uploader_comment')
        }),
        ('Map properties', {
            'classes': ('collapse',),
            'fields': ('descr', 'hint', 'world_name',
                       ('nr_players', 'w', 'h')
                       )
        }),
        ('Upload information', {
            'classes': ('collapse',),
            'fields': ('minimap', 'file', 'pub_date', 'nr_downloads', 'slug')
        }),
    )
admin.site.register(Map, MapAdmin)