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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
TAlone
memopol
Commits
42eb80b1
Commit
42eb80b1
authored
Apr 30, 2015
by
luxcem
Committed by
Arnaud Fabre
Apr 30, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new vote model
parent
1c99e625
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
30 deletions
+79
-30
.gitignore
.gitignore
+3
-0
representatives_votes/management/commands/__init__.py
representatives_votes/management/commands/__init__.py
+0
-0
representatives_votes/migrations/0001_initial.py
representatives_votes/migrations/0001_initial.py
+53
-0
representatives_votes/migrations/__init__.py
representatives_votes/migrations/__init__.py
+0
-0
representatives_votes/models.py
representatives_votes/models.py
+23
-30
No files found.
.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
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