mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-02-22 16:32:01 +00:00
- Added `wallet_balance` field to the User model. - Updated UserAdmin to include `wallet_balance` in the admin interface. - Created serializers and views for Atoll and Island management. - Implemented endpoints for listing, creating, and updating Atolls and Islands. - Enhanced payment processing with UUIDs for Payment and Topup models. - Added migration files for new fields and constraints. - Improved error handling and validation in various views. - Updated email templates for better responsiveness and SEO.
74 lines
1.8 KiB
Python
74 lines
1.8 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|
from api.models import User, Atoll, Island
|
|
from django.contrib.auth.models import Permission
|
|
|
|
|
|
# Define a new User admin
|
|
class UserAdmin(BaseUserAdmin):
|
|
list_display = (
|
|
"username",
|
|
"email",
|
|
"first_name",
|
|
"last_name",
|
|
"is_active",
|
|
"is_staff",
|
|
"mobile",
|
|
"address",
|
|
"wallet_balance",
|
|
"acc_no",
|
|
"id_card",
|
|
"dob",
|
|
"atoll",
|
|
"island",
|
|
"terms_accepted",
|
|
"policy_accepted",
|
|
) # Add custom fields here
|
|
|
|
fieldsets = (
|
|
(None, {"fields": ("username", "password")}),
|
|
(
|
|
"Personal info",
|
|
{
|
|
"fields": (
|
|
"first_name",
|
|
"last_name",
|
|
"email",
|
|
"mobile",
|
|
"address",
|
|
"wallet_balance",
|
|
"acc_no",
|
|
"id_card",
|
|
"dob",
|
|
"atoll",
|
|
"island",
|
|
"terms_accepted",
|
|
"policy_accepted",
|
|
)
|
|
},
|
|
), # Add custom fields here
|
|
(
|
|
"Permissions",
|
|
{
|
|
"fields": (
|
|
"is_active",
|
|
"is_staff",
|
|
"is_superuser",
|
|
"groups",
|
|
"user_permissions",
|
|
)
|
|
},
|
|
),
|
|
("Important dates", {"fields": ("last_login", "date_joined")}),
|
|
)
|
|
|
|
|
|
# Re-register UserAdmin
|
|
admin.site.register(User, UserAdmin)
|
|
admin.site.register(Permission)
|
|
admin.site.register(Atoll)
|
|
admin.site.register(Island)
|
|
|
|
|
|
# TokenAdmin.raw_id_fields = ["user"]
|