Django/DRF + PostgreSQL/Redis/Celery backend with accounts, library, moments, and notifications apps; React/TypeScript/Vite frontend with Instagram-style sidebar nav, feed, profiles, nested comment replies, notifications, and photo/video upload with ffmpeg-generated posters. Co-Authored-By: Claude Sonnet 5 <[email protected]>
9 lines
282 B
Python
9 lines
282 B
Python
from rest_framework.permissions import SAFE_METHODS, BasePermission
|
|
|
|
|
|
class IsOwnerOrReadOnly(BasePermission):
|
|
def has_object_permission(self, request, view, obj):
|
|
if request.method in SAFE_METHODS:
|
|
return True
|
|
return obj.owner_id == request.user.id
|