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:
pacnpal
2025-09-25 08:39:05 -04:00
parent b1c369c1bb
commit 41b3c86437
13 changed files with 481 additions and 479 deletions

View File

@@ -121,10 +121,6 @@ class User(AbstractUser):
"""Get the user's display name, falling back to username if not set"""
if self.display_name:
return self.display_name
# Fallback to profile display_name for backward compatibility
profile = getattr(self, "profile", None)
if profile and profile.display_name:
return profile.display_name
return self.username
def save(self, *args, **kwargs):
@@ -635,4 +631,6 @@ class NotificationPreference(TrackedModel):
def create_notification_preference(sender, instance, created, **kwargs):
"""Create notification preferences when a new user is created."""
if created:
NotificationPreference.objects.create(user=instance)
NotificationPreference.objects.get_or_create(user=instance)
# Signal moved to signals.py to avoid duplication