1
0
clubhaus-schornbach/clubhaus/homepage/admin.py

52 lines
1.3 KiB
Python

from django.contrib import admin
# Register your models here.
from .models import Tobacco, TobaccoCategory, ClubhausEvent, EventDate, EventDateVotes, VotingUser
@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(EventDateVotes)
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
]