Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
memopol
Commits
b51b963f
Commit
b51b963f
authored
Mar 18, 2015
by
luxcem
Browse files
Moves fix mandates active commands to memopol
parent
6febaf6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
memopol_representatives/management/__init__.py
0 → 100644
View file @
b51b963f
memopol_representatives/management/commands/__init__.py
0 → 100644
View file @
b51b963f
memopol_representatives/management/commands/fix_mandates_active.py
0 → 100644
View file @
b51b963f
import
datetime
from
django.core.management.base
import
BaseCommand
from
representatives.models
import
Mandate
from
django.db
import
transaction
class
Command
(
BaseCommand
):
@
transaction
.
atomic
def
handle
(
self
,
*
args
,
**
options
):
date
=
datetime
.
datetime
.
now
().
date
()
mandates
=
Mandate
.
objects
.
all
()
n
=
len
(
mandates
)
for
i
,
mandate
in
enumerate
(
mandates
):
mandate
.
active
=
mandate
.
end_date
>
date
mandate
.
save
()
print
(
"%s/%s
\r
"
%
(
i
,
n
)),
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