experiENS/avisstage/admin.py

48 lines
1 KiB
Python
Raw Normal View History

2021-02-07 23:24:33 +01:00
import authens.models as authmod
2017-04-04 00:31:50 +02:00
from django.contrib import admin
2017-04-07 03:01:27 +02:00
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
2017-04-04 00:31:50 +02:00
2021-02-07 23:24:33 +01:00
from avisstage.models import *
2021-02-07 18:23:24 +01:00
2021-02-07 23:15:47 +01:00
2017-04-07 03:01:27 +02:00
class NormalienInline(admin.StackedInline):
model = Normalien
inline_classes = ("collapse open",)
2021-02-07 23:15:47 +01:00
2017-04-07 03:01:27 +02:00
class UserAdmin(UserAdmin):
2021-02-07 23:15:47 +01:00
inlines = (NormalienInline,)
2017-04-07 03:01:27 +02:00
class AvisLieuInline(admin.StackedInline):
model = AvisLieu
inline_classes = ("collapse open",)
extra = 0
2021-02-07 23:15:47 +01:00
2017-04-07 03:01:27 +02:00
class AvisStageInline(admin.StackedInline):
model = AvisStage
inline_classes = ("collapse open",)
extra = 0
2021-02-07 23:15:47 +01:00
2017-04-07 03:01:27 +02:00
class StageAdmin(admin.ModelAdmin):
inlines = (AvisLieuInline, AvisStageInline)
2021-02-07 23:15:47 +01:00
2017-04-07 03:01:27 +02:00
class StageMatiereAdmin(admin.ModelAdmin):
model = StageMatiere
2021-02-07 23:15:47 +01:00
prepopulated_fields = {"slug": ("nom",)}
2017-04-07 03:01:27 +02:00
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
admin.site.register(Lieu)
admin.site.register(StageMatiere, StageMatiereAdmin)
admin.site.register(Stage, StageAdmin)
2021-02-07 18:23:24 +01:00
admin.site.register(authmod.CASAccount)
admin.site.register(authmod.OldCASAccount)