51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
|
|
from django.shortcuts import render
|
||
|
|
from datetime import datetime, timedelta
|
||
|
|
import pytz, random
|
||
|
|
|
||
|
|
from .models import *
|
||
|
|
from .serializers import *
|
||
|
|
|
||
|
|
from django.db.models import Q
|
||
|
|
|
||
|
|
from rest_framework import generics
|
||
|
|
from rest_framework.decorators import authentication_classes, permission_classes
|
||
|
|
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
|
||
|
|
|
||
|
|
from rest_framework.permissions import IsAuthenticated
|
||
|
|
# from durin.auth import TokenAuthentication
|
||
|
|
|
||
|
|
# from durin.views import APIAccessTokenView
|
||
|
|
|
||
|
|
from django_filters.rest_framework import DjangoFilterBackend
|
||
|
|
from rest_framework import filters
|
||
|
|
|
||
|
|
from rest_framework.response import Response
|
||
|
|
|
||
|
|
td = timedelta(hours=8)
|
||
|
|
odt = datetime.now() - td
|
||
|
|
|
||
|
|
# Create your views here.
|
||
|
|
class FAQsAPIView(generics.ListAPIView):
|
||
|
|
serializer_class = FAQSerializer
|
||
|
|
queryset = Faq.objects.filter(published=True).order_by('seq_num')
|
||
|
|
# filter_backends = [DjangoFilterBackend, filters.SearchFilter]
|
||
|
|
# filterset_fields = ['show_title', 'event_type', 'show_date', 'show_day', 'venue__name']
|
||
|
|
# search_fields = ['show_title', 'event_type']
|
||
|
|
|
||
|
|
|
||
|
|
class SocialPostsAPIView(generics.ListAPIView):
|
||
|
|
serializer_class = SocialPostSerializer
|
||
|
|
queryset = SocialPost.objects.filter(published=True)
|
||
|
|
|
||
|
|
|
||
|
|
class SocialLinksAPIView(generics.ListAPIView):
|
||
|
|
serializer_class = SocialLinkSerializer
|
||
|
|
queryset = SocialLink.objects.all()[:50]
|
||
|
|
|
||
|
|
|
||
|
|
class SocialImgsAPIView(generics.ListAPIView):
|
||
|
|
serializer_class = SocialImgsSerializer
|
||
|
|
queryset = SocialImg.objects.all()[:18]
|
||
|
|
|
||
|
|
|