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

Admin for club

This commit is contained in:
Alexandre Iooss 2019-07-16 15:17:57 +02:00
parent 5172f74845
commit 89cedd18f1
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
4 changed files with 14 additions and 3 deletions

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 from .models import Profile, Club
class ProfileInline(admin.StackedInline): class ProfileInline(admin.StackedInline):
@ -35,3 +35,4 @@ class CustomUserAdmin(UserAdmin):
admin.site.unregister(User) admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin) admin.site.register(User, CustomUserAdmin)
admin.site.register(Club)

View File

@ -56,7 +56,7 @@ msgstr "courriel"
#: models.py:70 #: models.py:70
msgid "membership fee" msgid "membership fee"
msgstr "cotisation" msgstr "cotisation pour adhérer"
#: models.py:74 #: models.py:74
msgid "membership duration" msgid "membership duration"

View File

@ -59,8 +59,9 @@ class Club(models.Model):
A student club A student club
""" """
name = models.CharField( name = models.CharField(
verbose_name=_('paid'), verbose_name=_('name'),
max_length=255, max_length=255,
unique=True,
) )
email = models.EmailField( email = models.EmailField(
verbose_name=_('email'), verbose_name=_('email'),
@ -94,6 +95,9 @@ class Club(models.Model):
verbose_name = _("club") verbose_name = _("club")
verbose_name_plural = _("clubs") verbose_name_plural = _("clubs")
def __str__(self):
return self.name
class Role(models.Model): class Role(models.Model):
""" """
@ -102,6 +106,7 @@ class Role(models.Model):
name = models.CharField( name = models.CharField(
verbose_name=_('name'), verbose_name=_('name'),
max_length=255, max_length=255,
unique=True,
) )
class Meta: class Meta:

View File

@ -17,6 +17,8 @@ class NoteClubAdmin(admin.ModelAdmin):
""" """
inlines = (AliasInlines,) inlines = (AliasInlines,)
list_display = ('club', 'balance', 'is_active') list_display = ('club', 'balance', 'is_active')
list_filter = ('is_active',)
search_fields = ['club__name']
class NoteSpecialAdmin(admin.ModelAdmin): class NoteSpecialAdmin(admin.ModelAdmin):
@ -32,9 +34,12 @@ class NoteUserAdmin(admin.ModelAdmin):
""" """
inlines = (AliasInlines,) inlines = (AliasInlines,)
list_display = ('user', 'balance', 'is_active') list_display = ('user', 'balance', 'is_active')
list_filter = ('is_active',)
search_fields = ['user__username']
# Organize note by registration date # Organize note by registration date
date_hierarchy = 'user__date_joined' date_hierarchy = 'user__date_joined'
ordering = ['-user__date_joined']
# Register your models here. # Register your models here.