experiENS/avisstage/admin.py
2021-02-07 18:23:24 +01:00

39 lines
1 KiB
Python

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from avisstage.models import *
import authens.models as authmod
class NormalienInline(admin.StackedInline):
model = Normalien
inline_classes = ("collapse open",)
class UserAdmin(UserAdmin):
inlines = (NormalienInline, )
class AvisLieuInline(admin.StackedInline):
model = AvisLieu
inline_classes = ("collapse open",)
extra = 0
class AvisStageInline(admin.StackedInline):
model = AvisStage
inline_classes = ("collapse open",)
extra = 0
class StageAdmin(admin.ModelAdmin):
inlines = (AvisLieuInline, AvisStageInline)
class StageMatiereAdmin(admin.ModelAdmin):
model = StageMatiere
prepopulated_fields = {"slug": ('nom',)}
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
admin.site.register(Lieu)
admin.site.register(StageMatiere, StageMatiereAdmin)
admin.site.register(Stage, StageAdmin)
admin.site.register(authmod.CASAccount)
admin.site.register(authmod.OldCASAccount)