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
71da78ad
Commit
71da78ad
authored
Jul 01, 2015
by
Arnaud Fabre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds a command to update country
parent
a7e24e13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
33 deletions
+4
-33
legislature/management/commands/update_memopol_representatives.py
...ure/management/commands/update_memopol_representatives.py
+3
-31
legislature/templates/legislature/representative_list.haml
legislature/templates/legislature/representative_list.haml
+1
-1
legislature/views.py
legislature/views.py
+0
-1
No files found.
legislature/management/commands/update_memopol_representatives.py
View file @
71da78ad
...
...
@@ -3,39 +3,11 @@ from __future__ import absolute_import
from
django.db
import
transaction
from
django.core.management.base
import
BaseCommand
import
pyprind
import
representatives.models
import
legislature.models
from
legislature.models
import
MemopolRepresentative
class
Command
(
BaseCommand
):
@
transaction
.
atomic
def
handle
(
self
,
*
args
,
**
options
):
bar
=
pyprind
.
ProgBar
(
representatives
.
models
.
Representative
.
objects
.
all
().
count
())
for
i
,
representative
in
enumerate
(
representatives
.
models
.
Representative
.
objects
.
all
()):
try
:
memopol_representative
=
legislature
.
models
.
MemopolRepresentative
.
objects
.
get
(
representative_remote_id
=
representative
.
remote_id
)
except
legislature
.
models
.
MemopolRepresentative
.
DoesNotExist
:
memopol_representative
=
legislature
.
models
.
MemopolRepresentative
(
representative_remote_id
=
representative
.
remote_id
)
memopol_representative
.
representative_ptr_id
=
representative
.
pk
memopol_representative
.
__dict__
.
update
(
representative
.
__dict__
)
memopol_representative
.
save
()
memopol_representative
.
update_country
()
bar
.
update
()
for
i
,
group_item
in
enumerate
(
representatives
.
models
.
Group
.
objects
.
all
()):
memopol_group
,
_
=
legislature
.
models
.
MemopolGroup
.
objects
.
get_or_create
(
group
=
group_item
)
memopol_group
.
__dict__
.
update
(
group_item
.
__dict__
)
memopol_group
.
update_active
()
memopol_group
.
save
()
for
representative
in
MemopolRepresentative
.
objects
.
all
():
representative
.
update_score
()
legislature/templates/legislature/representative_list.haml
View file @
71da78ad
-
extends
"base.html"
-
extends
'base.html'
-
block
content
...
...
legislature/views.py
View file @
71da78ad
...
...
@@ -15,7 +15,6 @@ def representatives_index(request):
active
=
True
)
)
return
_render_list
(
request
,
representative_list
)
...
...
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