mirror of https://gitlab.crans.org/bde/nk20
More admin
This commit is contained in:
parent
b63aaf4150
commit
740b468547
|
@ -1,3 +1,33 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Activity, ActivityType, Guest
|
||||
|
||||
|
||||
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']
|
||||
|
||||
|
||||
class ActivityTypeAdmin(admin.ModelAdmin):
|
||||
"""
|
||||
Admin customisation for ActivityType
|
||||
"""
|
||||
list_display = ('name', 'can_invite', 'guest_entry_fee')
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Activity, ActivityAdmin)
|
||||
admin.site.register(ActivityType, ActivityTypeAdmin)
|
||||
admin.site.register(Guest)
|
||||
|
|
|
@ -23,6 +23,9 @@ class ActivityType(models.Model):
|
|||
verbose_name = _("activity type")
|
||||
verbose_name_plural = _("activity types")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Activity(models.Model):
|
||||
name = models.CharField(
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.contrib.auth.admin import UserAdmin
|
|||
from django.contrib.auth.models import User
|
||||
|
||||
from .forms import CustomUserChangeForm
|
||||
from .models import Profile, Club
|
||||
from .models import Club, Profile
|
||||
|
||||
|
||||
class ProfileInline(admin.StackedInline):
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
from .models.notes import Alias, NoteClub, NoteSpecial, NoteUser
|
||||
from .models.transactions import MembershipTransaction, Transaction, \
|
||||
TransactionTemplate
|
||||
|
||||
|
||||
class AliasInlines(admin.TabularInline):
|
||||
|
@ -42,7 +48,18 @@ class NoteUserAdmin(admin.ModelAdmin):
|
|||
ordering = ['-user__date_joined']
|
||||
|
||||
|
||||
class TransactionTemplateAdmin(admin.ModelAdmin):
|
||||
"""
|
||||
Admin customisation for TransactionTemplate
|
||||
"""
|
||||
list_display = ('name', 'destination', 'amount', 'template_type')
|
||||
list_filter = ('destination', 'template_type',)
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(NoteClub, NoteClubAdmin)
|
||||
admin.site.register(NoteSpecial, NoteSpecialAdmin)
|
||||
admin.site.register(NoteUser, NoteUserAdmin)
|
||||
admin.site.register(MembershipTransaction)
|
||||
admin.site.register(Transaction)
|
||||
admin.site.register(TransactionTemplate, TransactionTemplateAdmin)
|
||||
|
|
Loading…
Reference in New Issue