2020-03-02 06:17:04 +00:00
|
|
|
from django.shortcuts import render
|
2020-04-03 17:27:49 +00:00
|
|
|
from rest_framework import viewsets, permissions
|
2020-03-02 06:17:04 +00:00
|
|
|
|
2020-04-03 17:27:49 +00:00
|
|
|
|
|
|
|
from .models import *
|
|
|
|
from .serializers import *
|
|
|
|
|
|
|
|
|
|
|
|
class VPNProductViewSet(viewsets.ModelViewSet):
|
|
|
|
serializer_class = VPNProductSerializer
|
|
|
|
permission_classes = [permissions.IsAdminUser]
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
if self.request.user.is_superuser:
|
|
|
|
obj = VPNProduct.objects.all()
|
|
|
|
else:
|
|
|
|
obj = VPNProduct.objects.filter(owner=self.request.user)
|
|
|
|
|
|
|
|
return obj
|