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
42eb80b1
Commit
42eb80b1
authored
Apr 30, 2015
by
luxcem
Committed by
Arnaud Fabre
Apr 30, 2015
Browse files
new vote model
parent
1c99e625
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
42eb80b1
*.sqlite3
*.sqlite
*.pyc
representatives_votes/management/commands/__init__.py
deleted
100644 → 0
View file @
1c99e625
representatives_votes/migrations/0001_initial.py
0 → 100644
View file @
42eb80b1
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Dossier'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'title'
,
models
.
CharField
(
max_length
=
500
)),
(
'reference'
,
models
.
CharField
(
max_length
=
200
)),
(
'text'
,
models
.
TextField
()),
(
'link'
,
models
.
URLField
()),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'Proposal'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'title'
,
models
.
CharField
(
max_length
=
500
)),
(
'description'
,
models
.
TextField
()),
(
'reference'
,
models
.
CharField
(
max_length
=
200
)),
(
'datetime'
,
models
.
DateTimeField
()),
(
'dossier'
,
models
.
ForeignKey
(
to
=
'representatives_votes.Dossier'
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'Vote'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'representative_slug'
,
models
.
CharField
(
max_length
=
200
,
null
=
True
,
blank
=
True
)),
(
'representative_remote_id'
,
models
.
CharField
(
max_length
=
200
,
null
=
True
,
blank
=
True
)),
(
'position'
,
models
.
CharField
(
max_length
=
10
,
choices
=
[(
b
'abstain'
,
b
'abstain'
),
(
b
'for'
,
b
'for'
),
(
b
'against'
,
b
'against'
)])),
(
'proposal'
,
models
.
ForeignKey
(
to
=
'representatives_votes.Proposal'
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
]
representatives_votes/m
anagement
/__init__.py
→
representatives_votes/m
igrations
/__init__.py
View file @
42eb80b1
File moved
representatives_votes/models.py
View file @
42eb80b1
# -*- coding:Utf-8 -*-
# coding: utf-8
from
django.db
import
models
from
parltrack_meps.models
import
MEP
class
Proposal
(
models
.
Model
):
title
=
models
.
TextField
(
null
=
True
)
code_name
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
date
=
models
.
DateField
(
default
=
None
,
null
=
True
,
blank
=
True
)
class
Dossier
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
500
)
reference
=
models
.
CharField
(
max_length
=
200
)
text
=
models
.
TextField
()
link
=
models
.
URLField
()
def
__unicode__
(
self
):
return
"%s [%s]"
%
(
self
.
title
if
self
.
title
else
"no title"
,
self
.
code_name
)
class
Meta
:
ordering
=
(
'-_date'
,
)
class
Proposal
(
models
.
Model
)
:
dossier
=
models
.
ForeignKey
(
Dossier
)
title
=
models
.
CharField
(
max_length
=
500
)
description
=
models
.
TextField
()
class
ProposalPart
(
models
.
Model
):
reference
=
models
.
CharField
(
max_length
=
200
)
datetime
=
models
.
DateTimeField
()
subject
=
models
.
CharField
(
max_length
=
255
)
part
=
models
.
CharField
(
max_length
=
255
)
description
=
models
.
CharField
(
max_length
=
511
)
proposal
=
models
.
ForeignKey
(
Proposal
)
def
__unicode__
(
self
):
return
self
.
subject
class
MetaClass
:
ordering
=
[
'datetime'
]
class
Vote
(
models
.
Model
):
choice
=
models
.
CharField
(
max_length
=
15
,
choices
=
((
u
'for'
,
u
'for'
),
(
u
'against'
,
u
'against'
),
(
u
'abstention'
,
u
'abstention'
),
(
u
'absent'
,
u
'absent'
)))
name
=
models
.
CharField
(
max_length
=
127
)
proposal_part
=
models
.
ForeignKey
(
ProposalPart
)
mep
=
models
.
ForeignKey
(
MEP
,
null
=
True
)
VOTECHOICES
=
(
(
'abstain'
,
'abstain'
),
(
'for'
,
'for'
),
(
'against'
,
'against'
)
)
proposal
=
models
.
ForeignKey
(
Proposal
)
class
Meta
:
ordering
=
[
"choice"
]
unique_together
=
(
"proposal_part"
,
"mep"
)
representative_slug
=
models
.
CharField
(
max_length
=
200
,
blank
=
True
,
null
=
True
)
representative_remote_id
=
models
.
CharField
(
max_length
=
200
,
blank
=
True
,
null
=
True
)
def
__unicode__
(
self
):
return
'%s (%s)'
%
(
self
.
name
,
self
.
choice
)
position
=
models
.
CharField
(
max_length
=
10
,
choices
=
VOTECHOICES
)
Write
Preview
Supports
Markdown
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