Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
flowspy
Commits
b4e7dff4
Commit
b4e7dff4
authored
Feb 15, 2012
by
Leonidas Poulopoulos
Browse files
Added a protocol field restriction for plain users
parent
14431a6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
flowspec/views.py
View file @
b4e7dff4
...
...
@@ -85,6 +85,7 @@ def add_route(request):
form
=
RouteForm
()
if
not
request
.
user
.
is_superuser
:
form
.
fields
[
'then'
]
=
forms
.
ModelMultipleChoiceField
(
queryset
=
ThenAction
.
objects
.
filter
(
action__in
=
settings
.
UI_USER_THEN_ACTIONS
).
order_by
(
'action'
),
required
=
True
)
form
.
fields
[
'protocol'
]
=
forms
.
ModelMultipleChoiceField
(
queryset
=
MatchProtocol
.
objects
.
filter
(
protocol__in
=
settings
.
UI_USER_PROTOCOLS
).
order_by
(
'protocol'
),
required
=
False
)
return
render_to_response
(
'apply.html'
,
{
'form'
:
form
,
'applier'
:
applier
},
context_instance
=
RequestContext
(
request
))
...
...
@@ -170,6 +171,7 @@ def edit_route(request, route_slug):
form
=
RouteForm
(
dictionary
)
if
not
request
.
user
.
is_superuser
:
form
.
fields
[
'then'
]
=
forms
.
ModelMultipleChoiceField
(
queryset
=
ThenAction
.
objects
.
filter
(
action__in
=
settings
.
UI_USER_THEN_ACTIONS
).
order_by
(
'action'
),
required
=
True
)
form
.
fields
[
'protocol'
]
=
forms
.
ModelMultipleChoiceField
(
queryset
=
MatchProtocol
.
objects
.
filter
(
protocol__in
=
settings
.
UI_USER_PROTOCOLS
).
order_by
(
'protocol'
),
required
=
False
)
return
render_to_response
(
'apply.html'
,
{
'form'
:
form
,
'edit'
:
True
,
'applier'
:
applier
},
context_instance
=
RequestContext
(
request
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment