1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

More admin

This commit is contained in:
Alexandre Iooss 2019-07-16 15:42:31 +02:00
parent b63aaf4150
commit 740b468547
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
4 changed files with 51 additions and 1 deletions

View File

@ -1,3 +1,33 @@
# -*- mode: python; coding: utf-8 -*- # -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay # Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # 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)

View File

@ -23,6 +23,9 @@ class ActivityType(models.Model):
verbose_name = _("activity type") verbose_name = _("activity type")
verbose_name_plural = _("activity types") verbose_name_plural = _("activity types")
def __str__(self):
return self.name
class Activity(models.Model): class Activity(models.Model):
name = models.CharField( name = models.CharField(

View File

@ -7,7 +7,7 @@ from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User from django.contrib.auth.models import User
from .forms import CustomUserChangeForm from .forms import CustomUserChangeForm
from .models import Profile, Club from .models import Club, Profile
class ProfileInline(admin.StackedInline): class ProfileInline(admin.StackedInline):

View File

@ -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 django.contrib import admin
from .models.notes import Alias, NoteClub, NoteSpecial, NoteUser from .models.notes import Alias, NoteClub, NoteSpecial, NoteUser
from .models.transactions import MembershipTransaction, Transaction, \
TransactionTemplate
class AliasInlines(admin.TabularInline): class AliasInlines(admin.TabularInline):
@ -42,7 +48,18 @@ class NoteUserAdmin(admin.ModelAdmin):
ordering = ['-user__date_joined'] 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. # Register your models here.
admin.site.register(NoteClub, NoteClubAdmin) admin.site.register(NoteClub, NoteClubAdmin)
admin.site.register(NoteSpecial, NoteSpecialAdmin) admin.site.register(NoteSpecial, NoteSpecialAdmin)
admin.site.register(NoteUser, NoteUserAdmin) admin.site.register(NoteUser, NoteUserAdmin)
admin.site.register(MembershipTransaction)
admin.site.register(Transaction)
admin.site.register(TransactionTemplate, TransactionTemplateAdmin)