kpsul/gestion/admin.py
Aurélien Delobelle fe840f2003 Add club view / update profile view
Profile view
- Let the user see his information.
- List the clubs whose he is a member.

Profile edition view
- Renamed from previous "profile" view
- User can now change "occupation" field.

Club detail view
- Informations about a club.
- Accessible by staff members and "respos" of the club.
- List members, with subscription fee (if applicable).

Club admin
- Change memberships of clubs added.
2017-08-09 12:53:44 +02:00

40 lines
688 B
Python

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from .models import Profile, Club
# ---
# The user related stuff
# ---
class ProfileInline(admin.StackedInline):
model = Profile
inline_classes = ["collapse open"]
class UserProfileAdmin(UserAdmin):
inlines = [
ProfileInline,
]
admin.site.unregister(User)
admin.site.register(User, UserProfileAdmin)
# ---
# Clubs
# ---
class ClubUserInline(admin.TabularInline):
model = Club.members.through
@admin.register(Club)
class ClubAdmin(admin.ModelAdmin):
inlines = [
ClubUserInline,
]
exclude = ('members',)