- Implement admin configurations for User, Member, Family, and FamilyMembership, with specialized inlines and filtered displays. - Introduce `UserCreationForm` and `UserChangeForm` for streamlined user management. - Enhance Family model with improved string representation and made name optional. - Add `Member.contact_email` property for prioritized email retrieval. - Include tests for the updated Family string logic, contact email functionality, and admin integration. - Add initial migration for club models (Club, ClubMembership) and updated migration for Family in the authentication app. - Configure IntelliJ IDEA for local SQLite database access.
21 lines
538 B
Python
21 lines
538 B
Python
from django.contrib.auth.forms import BaseUserCreationForm
|
|
from django.contrib.auth.forms import UserChangeForm as DjangoUserChangeForm
|
|
|
|
from .models import User
|
|
|
|
|
|
class UserCreationForm(BaseUserCreationForm):
|
|
"""Add-user form for the email-based custom User (no ``username`` field)."""
|
|
|
|
class Meta:
|
|
model = User
|
|
fields = ("email",)
|
|
|
|
|
|
class UserChangeForm(DjangoUserChangeForm):
|
|
"""Change-user form; keeps the read-only password hash widget."""
|
|
|
|
class Meta:
|
|
model = User
|
|
fields = "__all__"
|