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
8a819237
Commit
8a819237
authored
Mar 12, 2015
by
luxcem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates to the last version of django-representatives
parent
2294d01f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
116 deletions
+16
-116
memopol_representatives/admin.py
memopol_representatives/admin.py
+0
-52
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/update_representatives.py
...esentatives/management/commands/update_representatives.py
+0
-18
memopol_representatives/migrations/0001_initial.py
memopol_representatives/migrations/0001_initial.py
+0
-24
memopol_representatives/migrations/__init__.py
memopol_representatives/migrations/__init__.py
+0
-0
memopol_representatives/models.py
memopol_representatives/models.py
+0
-12
memopol_representatives/templates/memopol_representatives/list.haml
...presentatives/templates/memopol_representatives/list.haml
+4
-7
memopol_representatives/templates/memopol_representatives/representative_block.haml
...mplates/memopol_representatives/representative_block.haml
+10
-0
memopol_representatives/views.py
memopol_representatives/views.py
+2
-3
No files found.
memopol_representatives/admin.py
View file @
8a819237
from
django.contrib
import
admin
from
django.contrib
import
admin
import
representatives.models
as
models
from
memopol_representatives.models
import
MemopolRepresentative
class
EmailInline
(
admin
.
TabularInline
):
model
=
models
.
Email
extra
=
0
class
WebsiteInline
(
admin
.
TabularInline
):
model
=
models
.
WebSite
extra
=
0
class
AdressInline
(
admin
.
StackedInline
):
model
=
models
.
Address
extra
=
0
class
PhoneInline
(
admin
.
TabularInline
):
model
=
models
.
Phone
extra
=
0
class
MandateInline
(
admin
.
StackedInline
):
model
=
models
.
Mandate
extra
=
0
class
RepresentativeAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'full_name'
,
'gender'
,
'birth_place'
)
search_fields
=
(
'first_name'
,
'last_name'
,
'birth_place'
)
list_filter
=
(
'gender'
,
)
inlines
=
[
PhoneInline
,
EmailInline
,
WebsiteInline
,
AdressInline
,
MandateInline
]
class
MandateAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'kind'
,
'name'
,
'constituency'
,
'representative'
)
search_fields
=
(
'kind'
,
'name'
)
list_filter
=
(
'kind'
,)
admin
.
site
.
register
(
MemopolRepresentative
,
RepresentativeAdmin
)
admin
.
site
.
register
(
models
.
Country
)
admin
.
site
.
register
(
models
.
Mandate
,
MandateAdmin
)
memopol_representatives/management/__init__.py
deleted
100644 → 0
View file @
2294d01f
memopol_representatives/management/commands/__init__.py
deleted
100644 → 0
View file @
2294d01f
memopol_representatives/management/commands/update_representatives.py
deleted
100644 → 0
View file @
2294d01f
from
django.core.management.base
import
BaseCommand
from
django.db
import
transaction
from
memopol.utils
import
progress_bar
from
representatives.models
import
Representative
from
memopol_representatives.models
import
MemopolRepresentative
class
Command
(
BaseCommand
):
@
transaction
.
atomic
def
handle
(
self
,
*
args
,
**
options
):
n
=
Representative
.
objects
.
all
().
count
()
for
i
,
representative
in
enumerate
(
Representative
.
objects
.
all
()):
memopol_representative
=
MemopolRepresentative
(
representative_ptr
=
representative
)
memopol_representative
.
__dict__
.
update
(
representative
.
__dict__
)
# Auto set active flag of the memopol representative
memopol_representative
.
update_active
()
progress_bar
(
i
,
n
)
memopol_representatives/migrations/0001_initial.py
deleted
100644 → 0
View file @
2294d01f
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'representatives'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'MemopolRepresentative'
,
fields
=
[
(
'representative_ptr'
,
models
.
OneToOneField
(
parent_link
=
True
,
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
'representatives.Representative'
)),
(
'active'
,
models
.
BooleanField
(
default
=
False
)),
],
options
=
{
},
bases
=
(
'representatives.representative'
,),
),
]
memopol_representatives/migrations/__init__.py
deleted
100644 → 0
View file @
2294d01f
memopol_representatives/models.py
View file @
8a819237
from
django.db
import
models
from
django.db
import
models
from
representatives.models
import
Representative
class
MemopolRepresentative
(
Representative
):
active
=
models
.
BooleanField
(
default
=
False
)
def
update_active
(
self
):
if
self
.
mandate_set
.
filter
(
end_date
=
"9999-12-31"
):
self
.
active
=
True
else
:
self
.
active
=
False
self
.
save
()
memopol_representatives/templates/memopol_representatives/list.haml
View file @
8a819237
...
@@ -3,12 +3,9 @@
...
@@ -3,12 +3,9 @@
-
block
content
-
block
content
.row
.row
.large-8.columns
.large-8.columns
-
for
representative
in
memopolrepresentative_list
-
for
representative
in
representative_list
%p
.row
=
representative
.
full_name
-
include
'memopol_representatives/representative_block.html'
-
for
email
in
representative
.
email_set
.
all
%p
=
email
.
email
.large-4.columns
.large-4.columns
%p
%p
...
...
memopol_representatives/templates/memopol_representatives/representative_block.haml
0 → 100644
View file @
8a819237
%p
.small-2.columns
%img
{
'src'
:
'
=
{
representative
.
photo
}
'
}
/
%p
.small-4.columns
=
representative
.
full_name
[ ={representative.country.code} ]
%p
.small-6.columns
-
for
mandate
in
representative
.
mandate_set
.
all
={
mandate
.
group
.
name
}
-
=
{
mandate
.
end_date
}
-
=
{
mandate
.
active
}
%br
/a
memopol_representatives/views.py
View file @
8a819237
# from django.shortcuts import render
# from django.shortcuts import render
from
django.views
import
generic
from
django.views
import
generic
from
representatives.models
import
Representative
from
memopol_representatives.models
import
MemopolRepresentative
class
IndexView
(
generic
.
ListView
):
class
IndexView
(
generic
.
ListView
):
template_name
=
'memopol_representatives/list.html'
template_name
=
'memopol_representatives/list.html'
def
get_queryset
(
self
):
def
get_queryset
(
self
):
return
Memopol
Representative
.
objects
.
all
()
return
Representative
.
objects
.
all
()
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