Commit 5b0e6618 authored by Stauros Kroustouris's avatar Stauros Kroustouris

remove code used only for development

parent ced1a876
...@@ -56,7 +56,7 @@ Here are some examples: ...@@ -56,7 +56,7 @@ Here are some examples:
- Retrieve a specific rule: - Retrieve a specific rule:
curl -X GET https:/fod.example.com/api/routes/<rule_id>/ -H 'Authorization: Token <Your users token>' curl -X GET https://fod.example.com/api/routes/<rule_id>/ -H 'Authorization: Token <Your users token>'
- In order to create or modify a rule you have to use POST/PUT methods. - In order to create or modify a rule you have to use POST/PUT methods.
......
...@@ -20,15 +20,13 @@ from flowspec.serializers import ( ...@@ -20,15 +20,13 @@ from flowspec.serializers import (
from rest_framework.response import Response from rest_framework.response import Response
from django.contrib.auth.models import User
class RouteViewSet(viewsets.ModelViewSet): class RouteViewSet(viewsets.ModelViewSet):
queryset = Route.objects.all() queryset = Route.objects.all()
serializer_class = RouteSerializer serializer_class = RouteSerializer
def get_queryset(self): def get_queryset(self):
if self.request.user.is_anonymous or self.request.user.is_superuser: if self.request.user.is_superuser:
return Route.objects.all() return Route.objects.all()
else: else:
return Route.objects.filter(applier=self.request.user) return Route.objects.filter(applier=self.request.user)
...@@ -43,10 +41,7 @@ class RouteViewSet(viewsets.ModelViewSet): ...@@ -43,10 +41,7 @@ class RouteViewSet(viewsets.ModelViewSet):
return Response(serializer.data) return Response(serializer.data)
def pre_save(self, obj): def pre_save(self, obj):
if self.request.user.is_anonymous: obj.applier = self.request.user
obj.applier = User.objects.all()[0]
else:
obj.applier = self.request.user
class PortViewSet(viewsets.ModelViewSet): class PortViewSet(viewsets.ModelViewSet):
......
// If the user clicks on Generate token,
// then the following function will ask django
// for a token and then present it
$(document).ready(function() { $(document).ready(function() {
$('a#generate_token').one('click', function (ev) { $('a#generate_token').one('click', function (ev) {
ev.preventDefault(); ev.preventDefault();
......
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