Ajout du champ 'shortname' à Games et Figurines

This commit is contained in:
Olivier DOSSMANN 2018-01-15 19:07:19 +01:00
parent 91cc57f166
commit f2d7a2dfd8
2 changed files with 23 additions and 27 deletions

View File

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext as _ from figurines.models import Figurine
from figurines.models import Set, Figurine from figurines.models import Set
class FigurineInline(admin.TabularInline): class FigurineInline(admin.TabularInline):
@ -10,8 +10,8 @@ class FigurineInline(admin.TabularInline):
class SetAdmin(admin.ModelAdmin): class SetAdmin(admin.ModelAdmin):
list_display = ('name',) list_display = ('shortname', 'name')
inlines = (FigurineInline,) inlines = (FigurineInline, )
admin.site.register(Set, SetAdmin) admin.site.register(Set, SetAdmin)

View File

@ -1,7 +1,13 @@
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from games.forms import GameForm from games.forms import GameForm
from games.models import Game, Platform, Timeline from games.models import Game
from games.models import Platform
from games.models import Timeline
class PlatformAdmin(admin.ModelAdmin):
list_display = ('shortname', 'name')
class StatusFilter(admin.SimpleListFilter): class StatusFilter(admin.SimpleListFilter):
@ -28,34 +34,24 @@ class StatusFilter(admin.SimpleListFilter):
class GameAdmin(admin.ModelAdmin): class GameAdmin(admin.ModelAdmin):
list_display = ( list_display = ('name', 'playing', 'status', 'wish')
'name', 'playing', 'status', 'wish') list_filter = [StatusFilter, 'playing', 'wish']
list_filter = [ search_fields = ('name', )
StatusFilter, fieldsets = [(_('Game Information'), {
'playing', 'fields': [('name', 'collection')]
'wish'] }), (_('Progress'), {
search_fields = ('name',) 'fields': [('status'), ('note')]
fieldsets = [ }), ('', {
(_('Game Information'), { 'fields': [('playing'), ('unplayed'), ('wish')]
'fields': [ })]
('name', 'collection')]}),
(_('Progress'),
{'fields': [
('status'),
('note')]}),
('',
{'fields': [
('playing'), ('unplayed'), ('wish')]})
]
form = GameForm form = GameForm
class TimelineAdmin(admin.ModelAdmin): class TimelineAdmin(admin.ModelAdmin):
list_display = ( list_display = ('date', 'status', 'item')
'date', 'status', 'item')
admin.site.register(Platform) admin.site.register(Platform, PlatformAdmin)
admin.site.register(Game, GameAdmin) admin.site.register(Game, GameAdmin)
admin.site.register(Timeline, TimelineAdmin) admin.site.register(Timeline, TimelineAdmin)