Activity admin site was missing

This commit is contained in:
Yohann D'ANELLO 2020-08-01 18:05:31 +02:00
parent cc04fa5555
commit 36f1a3f0d4
2 changed files with 24 additions and 5 deletions

View File

@ -3,9 +3,11 @@
from django.contrib import admin
from .models import Activity, ActivityType, Guest
from note_kfet.admin import admin_site
from .models import Activity, ActivityType, Guest, Entry
@admin.register(Activity, site=admin_site)
class ActivityAdmin(admin.ModelAdmin):
"""
Admin customisation for Activity
@ -19,6 +21,7 @@ class ActivityAdmin(admin.ModelAdmin):
ordering = ['-date_start']
@admin.register(ActivityType, site=admin_site)
class ActivityTypeAdmin(admin.ModelAdmin):
"""
Admin customisation for ActivityType
@ -26,7 +29,17 @@ class ActivityTypeAdmin(admin.ModelAdmin):
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)
@admin.register(Guest, site=admin_site)
class GuestAdmin(admin.ModelAdmin):
"""
Admin customisation for Guest
"""
list_display = ('last_name', 'first_name', 'activity', 'inviter')
@admin.register(Entry, site=admin_site)
class EntryAdmin(admin.ModelAdmin):
"""
Admin customisation for Entry
"""
list_display = ('note', 'activity', 'time', 'guest')

View File

@ -99,6 +99,9 @@ class Activity(models.Model):
verbose_name=_('open'),
)
def __str__(self):
return self.name
class Meta:
verbose_name = _("activity")
verbose_name_plural = _("activities")
@ -234,6 +237,9 @@ class Guest(models.Model):
return super().save(force_insert, force_update, using, update_fields)
def __str__(self):
return self.first_name + " " + self.last_name
class Meta:
verbose_name = _("guest")
verbose_name_plural = _("guests")