mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 08:31:08 -05:00
- Implement tests for RideLocation and CompanyHeadquarters models to verify functionality and data integrity. - Create a manual trigger test script for trending content calculation endpoint, including authentication and unauthorized access tests. - Develop a manufacturer sync test to ensure ride manufacturers are correctly associated with ride models. - Add tests for ParkLocation model, including coordinate setting and distance calculations between parks. - Implement a RoadTripService test suite covering geocoding, route calculation, park discovery, and error handling. - Create a unified map service test script to validate map functionality, API endpoints, and performance metrics.
52 lines
2.3 KiB
Python
52 lines
2.3 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from django.utils.html import format_html
|
|
from django.contrib.auth.models import Group
|
|
from django.http import HttpRequest
|
|
from django.db.models import QuerySet
|
|
|
|
# Import models from the backend location
|
|
from backend.apps.accounts.models import (
|
|
User,
|
|
UserProfile,
|
|
EmailVerification,
|
|
)
|
|
|
|
@admin.register(User)
|
|
class CustomUserAdmin(UserAdmin):
|
|
list_display = ('username', 'email', 'user_id', 'role', 'is_active', 'is_staff', 'date_joined')
|
|
list_filter = ('role', 'is_active', 'is_staff', 'is_banned', 'date_joined')
|
|
search_fields = ('username', 'email', 'user_id', 'display_name')
|
|
readonly_fields = ('user_id', 'date_joined', 'last_login')
|
|
|
|
fieldsets = (
|
|
(None, {'fields': ('username', 'password')}),
|
|
('Personal info', {'fields': ('email', 'display_name', 'user_id')}),
|
|
('Permissions', {'fields': ('role', 'is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}),
|
|
('Important dates', {'fields': ('last_login', 'date_joined')}),
|
|
('Moderation', {'fields': ('is_banned', 'ban_reason', 'ban_date')}),
|
|
('Preferences', {'fields': ('theme_preference', 'privacy_level')}),
|
|
('Notifications', {'fields': ('email_notifications', 'push_notifications')}),
|
|
)
|
|
|
|
@admin.register(UserProfile)
|
|
class UserProfileAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'profile_id', 'display_name', 'coaster_credits', 'dark_ride_credits')
|
|
list_filter = ('user__role', 'user__is_active')
|
|
search_fields = ('user__username', 'user__email', 'profile_id', 'display_name')
|
|
readonly_fields = ('profile_id',)
|
|
|
|
fieldsets = (
|
|
(None, {'fields': ('user', 'profile_id', 'display_name')}),
|
|
('Profile Info', {'fields': ('avatar', 'pronouns', 'bio')}),
|
|
('Social Media', {'fields': ('twitter', 'instagram', 'youtube', 'discord')}),
|
|
('Ride Statistics', {'fields': ('coaster_credits', 'dark_ride_credits', 'flat_ride_credits', 'water_ride_credits')}),
|
|
)
|
|
|
|
@admin.register(EmailVerification)
|
|
class EmailVerificationAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'token', 'created_at', 'last_sent')
|
|
list_filter = ('created_at', 'last_sent')
|
|
search_fields = ('user__username', 'user__email', 'token')
|
|
readonly_fields = ('token', 'created_at', 'last_sent')
|