# coding: utf-8
from rest_framework import viewsets
from kpi.models import UserAssetSubscription

from kpi.models.object_permission import get_anonymous_user
from kpi.serializers import UserAssetSubscriptionSerializer


class UserAssetSubscriptionViewSet(viewsets.ModelViewSet):
    queryset = UserAssetSubscription.objects.none()
    serializer_class = UserAssetSubscriptionSerializer
    lookup_field = 'uid'

    def get_queryset(self):
        user = self.request.user
        # Check if the user is anonymous. The
        # django.contrib.auth.models.AnonymousUser object doesn't work for
        # queries.
        if user.is_anonymous:
            user = get_anonymous_user()
        criteria = {'user': user}
        if 'asset__uid' in self.request.query_params:
            criteria['asset__uid'] = self.request.query_params[
                'asset__uid']
        return UserAssetSubscription.objects.filter(**criteria)

    def perform_create(self, serializer):
        serializer.save(user=self.request.user)

@@ -18,72 +18,33 @@
 rom 
-rest_framework import viewsets%0Afrom kpi.models import UserA
+kpi.views.v2.user_a
 sset
-S
+_s
 ubsc
@@ -54,97 +54,21 @@
 tion
-%0A%0Afrom kpi.models.object_permission import get_anonymous_user%0Afrom kpi.serializers
  import
+ (%0A   
  Use
@@ -89,25 +89,17 @@
 tion
-Serializer%0A%0A%0Aclas
+ViewSet a
 s Us
@@ -128,107 +128,21 @@
 wSet
-(viewsets.ModelViewSet):%0A    queryset = UserAssetSubscription.objects.none()%0A    serializer_
+V2,%0A)%0A%0A%0A
 class
- =
  Use
@@ -163,649 +163,54 @@
 tion
-Serializer%0A    lookup_field = 'uid'%0A%0A    def get_queryset(self):%0A        user = self.request.user%0A        # Check if the user is anonymous. The%0A        # django.contrib.auth.models.AnonymousUser object doesn't work for%0A        # queries.%0A        if user.is_anonymous:%0A            user = get_anonymous_user()%0A        criteria = %7B'user': user%7D%0A        if 'asset__uid' in self.request.query_params:%0A            criteria%5B'asset__uid'%5D = self.request.query_params%5B%0A                'asset__uid'%5D%0A        return UserAssetSubscription.objects.filter(**criteria)%0A%0A    def perform_create(self, serializer
+ViewSet(UserAssetSubscriptionViewSetV2
 ):%0A    
-    serializer.save(user=self.request.user)
+pass
 %0A

Remove redundant v1 `UserAssetSubscriptionViewSet`