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
c0c4d714
Commit
c0c4d714
authored
Nov 18, 2015
by
Jamesie Pic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip import of votes without recommendation
parent
d6108022
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
votes/models.py
votes/models.py
+16
-19
No files found.
votes/models.py
View file @
c0c4d714
# 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
django.db
import
models
from
django.utils.functional
import
cached_property
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
representatives_votes.management.commands
import
(
parltrack_import_votes
,)
# from representatives.models import Representative
from
representatives_votes.models
import
Vote
,
Proposal
,
Dossier
# from legislature.models import MemopolRepresentative
...
...
@@ -92,3 +75,17 @@ class MemopolVote(Vote):
return
-
weight
else
:
return
0
def
vote_pre_import
(
sender
,
vote_data
=
None
,
**
kwargs
):
dossiers
=
getattr
(
sender
,
'memopol_filters'
,
None
)
if
dossiers
is
None
:
sender
.
memopol_filters
=
dossiers
=
Dossier
.
objects
.
filter
(
proposals__recommendation__in
=
Recommendation
.
objects
.
all
()
).
values_list
(
'reference'
,
flat
=
True
)
if
vote_data
.
get
(
'epref'
,
None
)
not
in
dossiers
:
return
False
parltrack_import_votes
.
Command
.
vote_pre_import
.
connect
(
vote_pre_import
)
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