59 lines
1.4 KiB
Python
59 lines
1.4 KiB
Python
from django.contrib import admin
|
|
|
|
# Register your models here.
|
|
from .models import Tobacco, TobaccoCategory, ClubhausEvent, EventDate, EventDateVote, VotingUser, Setting
|
|
|
|
|
|
@admin.register(Tobacco)
|
|
class TobaccoAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'description', 'category', 'in_stock')
|
|
list_editable = ('in_stock',)
|
|
ordering = ('name',)
|
|
|
|
|
|
@admin.register(TobaccoCategory)
|
|
class TobaccoCategoryAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'name')
|
|
ordering = ('id',)
|
|
|
|
|
|
@admin.register(EventDate)
|
|
class EventDateAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "event", "date")
|
|
ordering = ("id",)
|
|
|
|
|
|
@admin.register(VotingUser)
|
|
class VotingUserAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "name", "modify_key")
|
|
ordering = ("id",)
|
|
|
|
|
|
@admin.register(EventDateVote)
|
|
class EventDateVotesAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "voter", "date", "available")
|
|
list_editable = ('available',)
|
|
ordering = ("id",)
|
|
|
|
|
|
class EventDateInline(admin.StackedInline):
|
|
model = EventDate
|
|
extra = 0
|
|
|
|
|
|
@admin.register(ClubhausEvent)
|
|
class ClubhausEventAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "name", "date", "active", "voting_locked")
|
|
list_editable = ('active', "voting_locked")
|
|
ordering = ("date",)
|
|
inlines = [
|
|
EventDateInline
|
|
]
|
|
|
|
|
|
@admin.register(Setting)
|
|
class SettingAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "active")
|
|
ordering = ("active", "id")
|
|
list_editable = ("active",)
|