mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-26 01:12:23 +00:00
56 lines
1.4 KiB
Python
56 lines
1.4 KiB
Python
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from django.contrib import admin
|
|
from note_kfet.admin import admin_site
|
|
|
|
from .forms import GuestForm
|
|
from .models import Activity, ActivityType, Entry, Guest, Opener
|
|
|
|
|
|
@admin.register(Activity, site=admin_site)
|
|
class ActivityAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for Activity
|
|
"""
|
|
list_display = ('name', 'activity_type', 'organizer')
|
|
list_filter = ('activity_type',)
|
|
search_fields = ['name', 'organizer__name']
|
|
|
|
# Organize activities by start date
|
|
date_hierarchy = 'date_start'
|
|
ordering = ['-date_start']
|
|
|
|
|
|
@admin.register(ActivityType, site=admin_site)
|
|
class ActivityTypeAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for ActivityType
|
|
"""
|
|
list_display = ('name', 'can_invite', 'guest_entry_fee')
|
|
|
|
|
|
@admin.register(Guest, site=admin_site)
|
|
class GuestAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for Guest
|
|
"""
|
|
list_display = ('last_name', 'first_name', 'activity', 'inviter')
|
|
form = GuestForm
|
|
|
|
|
|
@admin.register(Entry, site=admin_site)
|
|
class EntryAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for Entry
|
|
"""
|
|
list_display = ('note', 'activity', 'time', 'guest')
|
|
|
|
|
|
@admin.register(Opener, site=admin_site)
|
|
class OpenerAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for Opener
|
|
"""
|
|
list_display = ('activity', 'opener')
|