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
b51b963f
Commit
b51b963f
authored
Mar 18, 2015
by
luxcem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves fix mandates active commands to memopol
parent
6febaf6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
memopol_representatives/management/__init__.py
memopol_representatives/management/__init__.py
+0
-0
memopol_representatives/management/commands/__init__.py
memopol_representatives/management/commands/__init__.py
+0
-0
memopol_representatives/management/commands/fix_mandates_active.py
...epresentatives/management/commands/fix_mandates_active.py
+17
-0
No files found.
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