Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
memopol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TAlone
memopol
Commits
06778542
Commit
06778542
authored
May 24, 2017
by
Okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving the csrf exemption to the mixin. #195 /spend 20m
parent
edae7d86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/memopol/views/home.py
src/memopol/views/home.py
+0
-6
src/representatives_positions/views.py
src/representatives_positions/views.py
+6
-0
No files found.
src/memopol/views/home.py
View file @
06778542
...
@@ -5,8 +5,6 @@ import random
...
@@ -5,8 +5,6 @@ import random
from
django.db.models
import
Q
,
Count
from
django.db.models
import
Q
,
Count
from
django.views
import
generic
from
django.views
import
generic
from
django.utils.decorators
import
method_decorator
from
django.views.decorators.csrf
import
csrf_exempt
from
representatives.models
import
Chamber
,
Representative
from
representatives.models
import
Chamber
,
Representative
from
representatives_positions.views
import
PositionFormMixin
from
representatives_positions.views
import
PositionFormMixin
...
@@ -22,10 +20,6 @@ class HomeView(PositionFormMixin, RepresentativeViewMixin,
...
@@ -22,10 +20,6 @@ class HomeView(PositionFormMixin, RepresentativeViewMixin,
generic
.
TemplateView
):
generic
.
TemplateView
):
template_name
=
'home.html'
template_name
=
'home.html'
@
method_decorator
(
csrf_exempt
)
def
dispatch
(
self
,
*
args
,
**
kwargs
):
return
super
(
HomeView
,
self
).
dispatch
(
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
c
=
super
(
HomeView
,
self
).
get_context_data
(
**
kwargs
)
c
=
super
(
HomeView
,
self
).
get_context_data
(
**
kwargs
)
...
...
src/representatives_positions/views.py
View file @
06778542
from
django.views
import
generic
from
django.views
import
generic
from
django.views.decorators.csrf
import
csrf_exempt
from
django.utils.decorators
import
method_decorator
from
.forms
import
PositionForm
from
.forms
import
PositionForm
...
@@ -15,6 +17,10 @@ class PositionFormMixin(generic.View):
...
@@ -15,6 +17,10 @@ class PositionFormMixin(generic.View):
position_form
=
None
position_form
=
None
position_created
=
False
position_created
=
False
@
method_decorator
(
csrf_exempt
)
def
dispatch
(
self
,
*
args
,
**
kwargs
):
return
super
(
HomeView
,
self
).
dispatch
(
*
args
,
**
kwargs
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
'position-representatives'
in
request
.
POST
:
if
'position-representatives'
in
request
.
POST
:
self
.
position_form
=
PositionForm
(
request
.
POST
,
prefix
=
'position'
)
self
.
position_form
=
PositionForm
(
request
.
POST
,
prefix
=
'position'
)
...
...
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