mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:11:13 -05:00
Add initial migration for moderation app and resolve seed command issues
- Created an empty migration file for the moderation app to enable migrations. - Documented the resolution of the seed command failure due to missing moderation tables. - Identified and fixed a VARCHAR(10) constraint violation in the User model during seed data generation. - Updated role assignment in the seed command to comply with the field length constraint.
This commit is contained in:
@@ -31,7 +31,7 @@ class UserDeletionService:
|
||||
"is_active": False,
|
||||
"is_staff": False,
|
||||
"is_superuser": False,
|
||||
"role": User.Roles.USER,
|
||||
"role": "USER",
|
||||
"is_banned": True,
|
||||
"ban_reason": "System placeholder for deleted users",
|
||||
"ban_date": timezone.now(),
|
||||
@@ -178,7 +178,7 @@ class UserDeletionService:
|
||||
return False, "Superuser accounts cannot be deleted for security reasons. Please contact system administrator or remove superuser privileges first."
|
||||
|
||||
# Check if user has critical admin role
|
||||
if user.role == User.Roles.ADMIN and user.is_staff:
|
||||
if user.role == "ADMIN" and user.is_staff:
|
||||
return False, "Admin accounts with staff privileges cannot be deleted. Please remove admin privileges first or contact system administrator."
|
||||
|
||||
# Add any other business rules here
|
||||
|
||||
Reference in New Issue
Block a user