lots of updates :/

This commit is contained in:
2025-11-30 15:34:08 -05:00
parent 61e198ff55
commit e06a5d49f8
84 changed files with 6614 additions and 2297 deletions

View File

@@ -30,19 +30,21 @@ class EventsAPIView(generics.ListAPIView):
serializer_class = EventSerializer
queryset = Event.objects.filter(show_date__gte=odt).order_by('show_date')
filter_backends = [DjangoFilterBackend, filters.SearchFilter]
filterset_fields = ['show_title', 'event_type', 'venue__name', 'calendar__shortcode']
search_fields = ['show_title', 'event_type', 'venue__name']
filterset_fields = ['show_title', 'event_type', 'venue__name','show_day', 'calendar__shortcode',]
search_fields = ['show_title', 'event_type','show_day', 'venue__name', 'calendar__shortcode',]
permission_classes = [HasAPIKey]
class PromoAPIView(generics.ListAPIView):
serializer_class = PromoSerializer
queryset = Promo.objects.filter(published=True)
filterset_fields = ['organization__name', 'calendar__shortcode',]
search_fields = ['organization__name', 'calendar__shortcode',]
permission_classes = [HasAPIKey]
def get_queryset(self):
promo_objects = list(Promo.objects.filter(published=True))
print(len(promo_objects))
queryset = random.sample(promo_objects, 21)
calendar = self.request.GET.get('calendar__shortcode')
queryset = Promo.objects.filter(published=True, calendar__shortcode=calendar).order_by('?')
return queryset
# class EventsTokenAPIView(APIAccessTokenView):