2020-02-18 20:30:26 +00:00
|
|
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
2019-07-08 11:59:31 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2019-07-16 13:42:31 +00:00
|
|
|
|
|
|
|
from django.contrib import admin
|
2020-08-01 16:05:31 +00:00
|
|
|
from note_kfet.admin import admin_site
|
2020-08-06 10:50:24 +00:00
|
|
|
|
2020-08-15 22:35:13 +00:00
|
|
|
from .forms import GuestForm
|
2020-08-10 13:30:39 +00:00
|
|
|
from .models import Activity, ActivityType, Entry, Guest
|
2019-07-16 13:42:31 +00:00
|
|
|
|
|
|
|
|
2020-08-01 16:05:31 +00:00
|
|
|
@admin.register(Activity, site=admin_site)
|
2019-07-16 13:42:31 +00:00
|
|
|
class ActivityAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for Activity
|
|
|
|
"""
|
|
|
|
list_display = ('name', 'activity_type', 'organizer')
|
2020-03-07 21:28:59 +00:00
|
|
|
list_filter = ('activity_type',)
|
2019-07-16 13:42:31 +00:00
|
|
|
search_fields = ['name', 'organizer__name']
|
|
|
|
|
|
|
|
# Organize activities by start date
|
|
|
|
date_hierarchy = 'date_start'
|
|
|
|
ordering = ['-date_start']
|
|
|
|
|
|
|
|
|
2020-08-01 16:05:31 +00:00
|
|
|
@admin.register(ActivityType, site=admin_site)
|
2019-07-16 13:42:31 +00:00
|
|
|
class ActivityTypeAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for ActivityType
|
|
|
|
"""
|
|
|
|
list_display = ('name', 'can_invite', 'guest_entry_fee')
|
|
|
|
|
|
|
|
|
2020-08-01 16:05:31 +00:00
|
|
|
@admin.register(Guest, site=admin_site)
|
|
|
|
class GuestAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for Guest
|
|
|
|
"""
|
|
|
|
list_display = ('last_name', 'first_name', 'activity', 'inviter')
|
2020-08-15 21:03:49 +00:00
|
|
|
form = GuestForm
|
2020-08-01 16:05:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Entry, site=admin_site)
|
|
|
|
class EntryAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for Entry
|
|
|
|
"""
|
|
|
|
list_display = ('note', 'activity', 'time', 'guest')
|