Files
thrillwiki_django_no_react/backend/apps/media/apps.py
pacnpal d504d41de2 feat: complete monorepo structure with frontend and shared resources
- Add complete backend/ directory with full Django application
- Add frontend/ directory with Vite + TypeScript setup ready for Next.js
- Add comprehensive shared/ directory with:
  - Complete documentation and memory-bank archives
  - Media files and avatars (letters, park/ride images)
  - Deployment scripts and automation tools
  - Shared types and utilities
- Add architecture/ directory with migration guides
- Configure pnpm workspace for monorepo development
- Update .gitignore to exclude .django_tailwind_cli/ build artifacts
- Preserve all historical documentation in shared/docs/memory-bank/
- Set up proper structure for full-stack development with shared resources
2025-08-23 18:40:07 -04:00

35 lines
1.0 KiB
Python

from django.apps import AppConfig
from django.db.models.signals import post_migrate
def create_photo_permissions(sender, **kwargs):
"""Create custom permissions for photos"""
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from apps.media.models import Photo
content_type = ContentType.objects.get_for_model(Photo)
Permission.objects.get_or_create(
codename="add_photo",
name="Can add photo",
content_type=content_type,
)
Permission.objects.get_or_create(
codename="change_photo",
name="Can change photo",
content_type=content_type,
)
Permission.objects.get_or_create(
codename="delete_photo",
name="Can delete photo",
content_type=content_type,
)
class MediaConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.media"
def ready(self):
post_migrate.connect(create_photo_permissions, sender=self)