Selaa lähdekoodia

refactor(api): make SerialListView more idiomatic

Peter Thomassen 4 vuotta sitten
vanhempi
commit
d9bd5954a6
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 1 1
      api/desecapi/urls/version_1.py
  2. 2 2
      api/desecapi/views.py

+ 1 - 1
api/desecapi/urls/version_1.py

@@ -42,7 +42,7 @@ api_urls = [
     path('dyndns/update', views.DynDNS12UpdateView.as_view(), name='dyndns12update'),
     path('dyndns/update', views.DynDNS12UpdateView.as_view(), name='dyndns12update'),
 
 
     # Serials
     # Serials
-    path('serials/', views.SerialList.as_view(), name='serial'),
+    path('serials/', views.SerialListView.as_view(), name='serial'),
 
 
     # Donation
     # Donation
     path('donation/', views.DonationList.as_view(), name='donation'),
     path('donation/', views.DonationList.as_view(), name='donation'),

+ 2 - 2
api/desecapi/views.py

@@ -169,11 +169,11 @@ class DomainViewSet(IdempotentDestroyMixin,
                 parent_domain.update_delegation(instance)
                 parent_domain.update_delegation(instance)
 
 
 
 
-class SerialList(generics.ListAPIView):
+class SerialListView(APIView):
     permission_classes = (IsVPNClient,)
     permission_classes = (IsVPNClient,)
     throttle_classes = []  # don't break slaves when they ask too often (our cached responses are cheap)
     throttle_classes = []  # don't break slaves when they ask too often (our cached responses are cheap)
 
 
-    def list(self, request, *args, **kwargs):
+    def get(self, request, *args, **kwargs):
         key = 'desecapi.views.serials'
         key = 'desecapi.views.serials'
         serials = cache.get(key)
         serials = cache.get(key)
         if serials is None:
         if serials is None: