Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flowspy
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
flowspy
Commits
5b0e6618
Commit
5b0e6618
authored
10 years ago
by
Stauros Kroustouris
Browse files
Options
Downloads
Patches
Plain Diff
remove code used only for development
parent
ced1a876
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
flowspec/viewsets.py
+2
-7
2 additions, 7 deletions
flowspec/viewsets.py
static/js/accounts.js
+4
-0
4 additions, 0 deletions
static/js/accounts.js
with
7 additions
and
8 deletions
README.md
+
1
−
1
View file @
5b0e6618
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
flowspec/viewsets.py
+
2
−
7
View file @
5b0e6618
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
static/js/accounts.js
+
4
−
0
View file @
5b0e6618
// 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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment