mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 14:59:36 +02:00
- Implemented unsharing functionality in CollectionViewSet, including removal of user-owned locations from collections. - Refactored ContentImageViewSet to support multiple content types and improved permission checks for image uploads. - Added user ownership checks in LocationViewSet for delete operations. - Enhanced collection management in the frontend to display both owned and shared collections separately. - Updated Immich integration to handle access control based on location visibility and user permissions. - Improved UI components to show creator information and manage collection links more effectively. - Added loading states and error handling in collection fetching logic.
17 lines
509 B
Python
17 lines
509 B
Python
from django.db import models
|
|
from django.db.models import Q
|
|
|
|
class LocationManager(models.Manager):
|
|
def retrieve_locations(self, user, include_owned=False, include_shared=False, include_public=False):
|
|
query = Q()
|
|
|
|
if include_owned:
|
|
query |= Q(user=user)
|
|
|
|
if include_shared:
|
|
query |= Q(collections__shared_with=user) | Q(collections__user=user)
|
|
|
|
if include_public:
|
|
query |= Q(is_public=True)
|
|
|
|
return self.filter(query).distinct()
|