Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
django-representatives
Commits
57f8f75e
Commit
57f8f75e
authored
Oct 27, 2012
by
Yohan Boniface
Browse files
Initial commit
parents
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
57f8f75e
*.pyc
\ No newline at end of file
django_representatives/__init__.py
0 → 100644
View file @
57f8f75e
django_representatives/models.py
0 → 100644
View file @
57f8f75e
from
django.db
import
models
class
Country
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
)
code
=
models
.
CharField
(
max_length
=
2
)
class
Representative
(
models
.
Model
):
"""
FIXME
"""
N_A
=
0
F
=
1
M
=
2
GENDER
=
(
(
N_A
,
"N/A"
),
(
F
,
"F"
),
(
M
,
"M"
),
)
remote_id
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
first_name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
last_name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
full_name
=
models
.
CharField
(
max_length
=
255
)
gender
=
models
.
SmallIntergerField
(
choices
=
GENDER
,
default
=
N_A
)
birth_place
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
birth_date
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
cv
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
class
Contact
(
models
.
Model
):
representative
=
models
.
ForeignKey
(
Representative
)
class
Meta
:
abstract
=
True
class
Email
(
Contact
):
email
=
models
.
EmailField
()
kind
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
class
WebSite
(
Contact
):
url
=
models
.
URLField
()
kind
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
class
Address
(
Contact
):
country
=
models
.
ForeignKey
(
Country
)
city
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
street
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
number
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
postcode
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
floor
=
models
.
SmallIntergerField
(
blank
=
True
,
null
=
True
)
office_number
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
kind
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
location
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
# TODO Find standard for storage in charfield
class
Phone
(
Contact
):
number
=
models
.
CharField
(
max_length
=
255
)
kind
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
address
=
models
.
ForeignKey
(
Address
)
class
Mandate
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
)
kind
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
short_id
=
models
.
CharField
(
max_length
=
25
,
blank
=
True
,
null
=
True
)
url
=
models
.
URLField
()
constituency
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
,
help_text
=
"Authority for which the mandate is realized. Eg.: a eurodeputies has a mandate at the European Parliament for a country"
)
role
=
models
.
CharField
(
max_length
=
25
,
blank
=
True
,
null
=
True
,
help_text
=
"Eg.: president of a political group at the European Parliament"
)
begin_date
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
end_date
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
# Sometimes begin_date and end_date are not available
active
=
models
.
NullBooleanField
(
default
=
False
)
django_representatives/tests.py
0 → 100644
View file @
57f8f75e
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from
django.test
import
TestCase
class
SimpleTest
(
TestCase
):
def
test_basic_addition
(
self
):
"""
Tests that 1 + 1 always equals 2.
"""
self
.
assertEqual
(
1
+
1
,
2
)
django_representatives/views.py
0 → 100644
View file @
57f8f75e
# Create your views here.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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