Commit 740b4685 authored by erdnaxe's avatar erdnaxe 🎇

More admin

parent b63aaf41
Pipeline #1349 passed with stage
in 2 minutes and 24 seconds
# -*- 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):
......
# -*- 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment