forked from wiktor/spejstore-new
Make paths publically available due to beyondspace
This commit is contained in:
parent
3a286a5bc6
commit
8048fccede
|
@ -1,6 +1,7 @@
|
||||||
from rest_framework import viewsets, filters
|
from rest_framework import viewsets, filters
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.permissions import AllowAny
|
||||||
from storage.authentication import LanAuthentication
|
from storage.authentication import LanAuthentication
|
||||||
|
|
||||||
from storage.models import Item, Label
|
from storage.models import Item, Label
|
||||||
|
@ -81,6 +82,9 @@ class ItemViewSet(viewsets.ModelViewSet):
|
||||||
@action(
|
@action(
|
||||||
detail=True,
|
detail=True,
|
||||||
methods=["post"],
|
methods=["post"],
|
||||||
|
# AllowAny is correct here, as we require LanAuthentication anyways
|
||||||
|
permission_classes=[AllowAny],
|
||||||
|
authentication_classes=[LanAuthentication],
|
||||||
)
|
)
|
||||||
def print(self, request, pk):
|
def print(self, request, pk):
|
||||||
return api_print(request.query_params.get("quantity", 1), self.get_object())
|
return api_print(request.query_params.get("quantity", 1), self.get_object())
|
||||||
|
|
|
@ -58,7 +58,6 @@ def apply_smart_search(query, objects):
|
||||||
return objects
|
return objects
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def index(request):
|
def index(request):
|
||||||
# get_roots was removed, so we're doing it this way now.
|
# get_roots was removed, so we're doing it this way now.
|
||||||
return render(
|
return render(
|
||||||
|
@ -66,7 +65,6 @@ def index(request):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def search(request):
|
def search(request):
|
||||||
query = request.GET.get("q", "")
|
query = request.GET.get("q", "")
|
||||||
|
|
||||||
|
@ -85,7 +83,6 @@ def search(request):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def item_display(request, pk):
|
def item_display(request, pk):
|
||||||
if not pk:
|
if not pk:
|
||||||
return index(request)
|
return index(request)
|
||||||
|
@ -125,7 +122,6 @@ def label_lookup(request, pk):
|
||||||
raise Http404("Very sad to say, I could not find this thing")
|
raise Http404("Very sad to say, I could not find this thing")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def apitoken(request):
|
def apitoken(request):
|
||||||
print(Token)
|
print(Token)
|
||||||
token, created = Token.objects.get_or_create(user=request.user)
|
token, created = Token.objects.get_or_create(user=request.user)
|
||||||
|
|
Loading…
Reference in New Issue