|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
|
|
from django.http import JsonResponse |
|
|
|
from django.http import JsonResponse |
|
|
|
from django.db.models import Q |
|
|
|
from django.db.models import Q |
|
|
|
from rest_framework import viewsets, permissions, status, filters |
|
|
|
from rest_framework import viewsets, permissions, status, filters |
|
|
@ -10,6 +12,7 @@ from rest_framework.response import Response |
|
|
|
from rest_framework_extensions.cache.mixins import CacheResponseMixin |
|
|
|
from rest_framework_extensions.cache.mixins import CacheResponseMixin |
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
from django.views.decorators.cache import cache_page |
|
|
|
from django.views.decorators.cache import cache_page |
|
|
|
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
from django_filters.rest_framework import DjangoFilterBackend |
|
|
|
from django_filters.rest_framework import DjangoFilterBackend |
|
|
|
from django.core.cache import cache |
|
|
|
from django.core.cache import cache |
|
|
|
from update.utils.get_version import GetVersion |
|
|
|
from update.utils.get_version import GetVersion |
|
|
@ -32,7 +35,7 @@ class CinemaViewSet(CacheResponseMixin, viewsets.ModelViewSet): |
|
|
|
""" |
|
|
|
""" |
|
|
|
queryset = Cinema.objects.all() |
|
|
|
queryset = Cinema.objects.all() |
|
|
|
serializer_class = CinemaSerializer |
|
|
|
serializer_class = CinemaSerializer |
|
|
|
permission_classes = (permissions.IsAuthenticated,) |
|
|
|
# permission_classes = (permissions.IsAuthenticated,) |
|
|
|
filter_backends = (filters.SearchFilter, DjangoFilterBackend, OrderingFilter) |
|
|
|
filter_backends = (filters.SearchFilter, DjangoFilterBackend, OrderingFilter) |
|
|
|
ordering_fields = ('ip',) |
|
|
|
ordering_fields = ('ip',) |
|
|
|
search_fields = ('sys_ver',) |
|
|
|
search_fields = ('sys_ver',) |
|
|
@ -64,6 +67,14 @@ class CinemaUserViewSet(CacheResponseMixin, viewsets.ModelViewSet): |
|
|
|
# serializer = CinemaSerializer(instance=query_data, many=True) |
|
|
|
# serializer = CinemaSerializer(instance=query_data, many=True) |
|
|
|
# return Response(serializer.data, status=status.HTTP_200_OK) |
|
|
|
# return Response(serializer.data, status=status.HTTP_200_OK) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt |
|
|
|
|
|
|
|
def update_user(request, *args, **kwargs): |
|
|
|
|
|
|
|
cinema_id = request.GET.dict().get('id') |
|
|
|
|
|
|
|
user = json.loads(request.body).get('user', '暂无') |
|
|
|
|
|
|
|
result = Cinema.objects.filter(id=cinema_id).update(user=user) |
|
|
|
|
|
|
|
return JsonResponse({'result': 'success'} if result == 1 else {'result': 'fail'}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_git_version(request): |
|
|
|
def get_git_version(request): |
|
|
|
git_util = GitUtil() |
|
|
|
git_util = GitUtil() |
|
|
|
git_ver = git_util.get_short_version() |
|
|
|
git_ver = git_util.get_short_version() |
|
|
|