Commit 267806e3 authored by David Haynes's avatar David Haynes 🙆

API query for specific golinks using the short

- GET /api/golinks/pls
parent 34623c47
Pipeline #2758 passed with stage
in 1 minute
...@@ -12,4 +12,5 @@ from rest_framework import serializers ...@@ -12,4 +12,5 @@ from rest_framework import serializers
class URLSerializer(serializers.HyperlinkedModelSerializer): class URLSerializer(serializers.HyperlinkedModelSerializer):
class Meta: class Meta:
model = URL model = URL
lookup_field = 'short'
fields = ('destination', 'short', 'date_expires') fields = ('destination', 'short', 'date_expires')
...@@ -44,6 +44,7 @@ class URLViewSet(viewsets.ModelViewSet): ...@@ -44,6 +44,7 @@ class URLViewSet(viewsets.ModelViewSet):
""" """
serializer_class = URLSerializer serializer_class = URLSerializer
permission_classes = (URLPermission,) permission_classes = (URLPermission,)
lookup_field = 'short'
def get_queryset(self): def get_queryset(self):
if not self.request.user.is_staff: if not self.request.user.is_staff:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment