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
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
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
Political Memory
memopol
Commits
1aeac2f7
Commit
1aeac2f7
authored
Nov 29, 2015
by
Jamesie Pic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed broken views
parent
a06c58ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
143 deletions
+0
-143
legislature/admin.py
legislature/admin.py
+0
-4
legislature/admin_views.py
legislature/admin_views.py
+0
-29
votes/admin.py
votes/admin.py
+0
-4
votes/admin_views.py
votes/admin_views.py
+0
-106
No files found.
legislature/admin.py
View file @
1aeac2f7
...
...
@@ -23,13 +23,9 @@ from django.contrib import admin
from
representatives.models
import
Email
,
WebSite
,
Address
,
Phone
,
Country
from
.admin_views
import
representatives_update_all
from
.models
import
MemopolRepresentative
admin
.
site
.
register_view
(
'representatives_update_all'
,
view
=
representatives_update_all
)
class
EmailInline
(
admin
.
TabularInline
):
model
=
Email
extra
=
0
...
...
legislature/admin_views.py
deleted
100644 → 0
View file @
a06c58ee
# coding: utf-8
# This file is part of mempol.
#
# mempol is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or any later version.
#
# mempol is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Affero Public
# License along with django-representatives.
# If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
from
__future__
import
absolute_import
from
django.shortcuts
import
redirect
from
.tasks
import
representatives_update_all
as
rpr_update_task
def
representatives_update_all
(
request
):
rpr_update_task
.
delay
()
return
redirect
(
'/admin'
)
votes/admin.py
View file @
1aeac2f7
...
...
@@ -5,12 +5,8 @@ from autocomplete_light import shortcuts as ac
from
django.contrib
import
admin
from
django.core.urlresolvers
import
reverse
from
.admin_views
import
import_vote_with_recommendation
,
import_vote
from
.models
import
Recommendation
,
MemopolDossier
admin
.
site
.
register_view
(
'import_vote'
,
view
=
import_vote
)
admin
.
site
.
register_view
(
'import_vote_with_recommendation'
,
view
=
import_vote_with_recommendation
)
def
link_to_edit
(
obj
,
field
):
try
:
related_obj
=
getattr
(
obj
,
field
)
...
...
votes/admin_views.py
deleted
100644 → 0
View file @
a06c58ee
# coding: utf-8
# This file is part of memopol.
#
# memopol is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or any later version.
#
# memopol is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Affero Public
# License along with django-representatives.
# If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
from
__future__
import
absolute_import
from
django.conf
import
settings
from
django.shortcuts
import
render
,
redirect
from
django
import
forms
import
requests
from
representatives_votes.tasks
import
import_a_proposal_from_toutatis
from
.forms
import
RecommendationForm
class
SearchForm
(
forms
.
Form
):
query
=
forms
.
CharField
(
label
=
'Search'
,
max_length
=
100
)
def
import_vote_with_recommendation
(
request
):
context
=
{}
toutatis_server
=
getattr
(
settings
,
'TOUTATIS_SERVER'
,
'http://toutatis.mm.staz.be'
)
if
request
.
method
==
'POST'
and
'search'
in
request
.
POST
:
form
=
SearchForm
(
request
.
POST
)
if
form
.
is_valid
():
query
=
form
.
cleaned_data
[
'query'
]
context
[
'api_url'
]
=
'{}/api/proposals/?search={}&limit=30'
.
format
(
toutatis_server
,
query
)
r
=
requests
.
get
(
context
[
'api_url'
])
context
[
'results'
]
=
r
.
json
()
elif
request
.
method
==
'POST'
and
'create_recommendation'
in
request
.
POST
:
form
=
RecommendationForm
(
data
=
request
.
POST
)
if
form
.
is_valid
():
# First import proposal
proposal_fingerprint
=
request
.
POST
[
'proposal_fingerprint'
]
proposal
=
import_a_proposal_from_toutatis
(
proposal_fingerprint
)
recommendation
=
form
.
save
(
commit
=
False
)
recommendation
.
proposal
=
proposal
recommendation
.
save
()
return
redirect
(
'/admin/votes/recommendation/'
)
else
:
proposal_fingerprint
=
request
.
GET
.
get
(
'import'
,
None
)
if
proposal_fingerprint
:
api_url
=
'{}/api/proposals/?fingerprint={}'
.
format
(
toutatis_server
,
proposal_fingerprint
)
proposal
=
requests
.
get
(
api_url
).
json
()[
'results'
][
0
]
context
[
'recommendation_proposal_title'
]
=
proposal
[
'title'
]
context
[
'recommendation_proposal_dossier_title'
]
=
proposal
[
'dossier_title'
]
context
[
'recommendation_proposal_fingerprint'
]
=
proposal
[
'fingerprint'
]
context
[
'recommendation_form'
]
=
RecommendationForm
()
form
=
SearchForm
()
context
[
'form'
]
=
form
return
render
(
request
,
'votes/admin/import.html'
,
context
)
def
import_vote
(
request
):
context
=
{}
toutatis_server
=
getattr
(
settings
,
'TOUTATIS_SERVER'
,
'http://toutatis.mm.staz.be'
)
if
request
.
method
==
'POST'
and
'search'
in
request
.
POST
:
print
(
request
.
POST
)
form
=
SearchForm
(
request
.
POST
)
if
form
.
is_valid
():
query
=
form
.
cleaned_data
[
'query'
]
context
[
'api_url'
]
=
'{}/api/proposals/?search={}&limit=1000'
.
format
(
toutatis_server
,
query
)
r
=
requests
.
get
(
context
[
'api_url'
])
context
[
'results'
]
=
r
.
json
()
else
:
proposal_fingerprint
=
request
.
GET
.
get
(
'import'
,
None
)
if
proposal_fingerprint
:
import_a_proposal_from_toutatis
(
proposal_fingerprint
)
return
redirect
(
'/admin/'
)
form
=
SearchForm
()
context
[
'form'
]
=
form
return
render
(
request
,
'votes/admin/import.html'
,
context
)
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