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
memopol
Commits
002ab738
Commit
002ab738
authored
Sep 01, 2016
by
Nicolas Joyard
Browse files
Cleanup unused views
parent
9a36e6ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
memopol/urls.py
View file @
002ab738
...
...
@@ -4,16 +4,13 @@ from django.contrib import admin
from
views.home
import
HomeView
from
views.dossier_ac
import
DossierAutocomplete
,
ProposalAutocomplete
from
views.dossier_ac
import
ProposalAutocomplete
from
views.dossier_detail_base
import
DossierDetailBase
from
views.dossier_detail_recommendations
import
DossierDetailRecommendations
from
views.dossier_detail_proposals
import
DossierDetailProposals
from
views.dossier_detail_documents
import
DossierDetailDocuments
from
views.dossier_list
import
DossierList
from
views.group_ac
import
GroupAutocomplete
from
views.group_list
import
GroupList
from
views.representative_detail_base
import
RepresentativeDetailBase
from
views.representative_detail_votes
import
RepresentativeDetailVotes
from
views.representative_detail_mandates
import
RepresentativeDetailMandates
...
...
@@ -82,32 +79,11 @@ urlpatterns = [
RepresentativeDetailPositions
.
as_view
(),
name
=
'representative-positions'
),
url
(
r
'^legislature/group/$'
,
GroupList
.
as_view
(),
name
=
'group-list'
),
url
(
r
'^legislature/groups/$'
,
RedirectGroupList
.
as_view
(),
name
=
'group-list-redirect'
),
url
(
r
'^legislature/group/(?P<kind>\w+)/$'
,
GroupList
.
as_view
(),
name
=
'group-list'
),
url
(
r
'^legislature/groups/(?P<kind>\w+)/$'
,
RedirectGroupList
.
as_view
(),
name
=
'group-list-redirect'
),
url
(
r
'^legislature/autocomplete/group/$'
,
GroupAutocomplete
.
as_view
(),
name
=
'group-autocomplete'
,
),
url
(
r
'^votes/dossier/$'
,
DossierList
.
as_view
(),
...
...
@@ -138,11 +114,6 @@ urlpatterns = [
DossierDetailDocuments
.
as_view
(),
name
=
'dossier-documents'
),
url
(
r
'^votes/autocomplete/dossier/$'
,
DossierAutocomplete
.
as_view
(),
name
=
'dossier-autocomplete'
,
),
url
(
r
'^votes/autocomplete/proposal/$'
,
ProposalAutocomplete
.
as_view
(),
...
...
memopol/views/dossier_ac.py
View file @
002ab738
...
...
@@ -7,19 +7,6 @@ from django.db.models import Q
from
representatives_votes.models
import
Dossier
,
Proposal
class
DossierAutocomplete
(
autocomplete
.
Select2QuerySetView
):
def
get_queryset
(
self
):
qs
=
Dossier
.
objects
.
all
()
if
self
.
q
:
qs
=
qs
.
filter
(
Q
(
title__icontains
=
self
.
q
)
|
Q
(
reference__icontains
=
self
.
q
)
)
return
qs
class
ProposalAutocomplete
(
autocomplete
.
Select2QuerySetView
):
def
get_queryset
(
self
):
qs
=
Proposal
.
objects
.
all
()
...
...
memopol/views/group_ac.py
deleted
100644 → 0
View file @
9a36e6ea
# coding: utf-8
from
core.views
import
ActiveLegislatureMixin
from
dal.autocomplete
import
Select2QuerySetView
import
datetime
from
django.db.models
import
Q
from
representatives.models
import
Group
class
GroupAutocomplete
(
Select2QuerySetView
,
ActiveLegislatureMixin
):
def
get_queryset
(
self
):
qs
=
Group
.
objects
.
distinct
().
exclude
(
kind__in
=
[
'chamber'
,
'country'
])
if
self
.
get_active_only
():
qs
=
qs
.
filter
(
Q
(
mandates__end_date__gte
=
datetime
.
date
.
today
())
|
Q
(
mandates__end_date__isnull
=
True
)
)
if
self
.
q
:
qs
=
qs
.
filter
(
Q
(
name__icontains
=
self
.
q
)
|
Q
(
abbreviation__icontains
=
self
.
q
)
)
return
qs
memopol/views/group_list.py
deleted
100644 → 0
View file @
9a36e6ea
# coding: utf-8
import
datetime
from
core.views
import
PaginationMixin
,
ActiveLegislatureMixin
from
django.db
import
models
from
django.views
import
generic
from
representatives.models
import
Group
class
GroupList
(
PaginationMixin
,
ActiveLegislatureMixin
,
generic
.
ListView
):
def
override_active_only
(
self
):
kind
=
self
.
kwargs
.
get
(
'kind'
)
if
kind
==
'chamber'
or
kind
==
'country'
:
return
False
else
:
return
None
def
get_queryset
(
self
):
qs
=
Group
.
objects
.
all
()
if
self
.
get_active_only
():
qs
=
qs
.
filter
(
models
.
Q
(
mandates__end_date__gte
=
datetime
.
date
.
today
())
|
models
.
Q
(
mandates__end_date__isnull
=
True
)
)
kind
=
self
.
kwargs
.
get
(
'kind'
,
None
)
if
kind
:
qs
=
qs
.
filter
(
kind
=
kind
).
distinct
()
return
qs
.
select_related
(
'chamber'
).
order_by
(
'chamber__name'
,
'name'
)
templates/representatives/group_list.html
deleted
100644 → 0
View file @
9a36e6ea
{% extends 'base.html' %}
{% load memopol_tags %}
{% block content %}
{% include 'core/blocks/pagination.html' %}
{% block list %}
<table>
{% for group in object_list %}
<tr>
{% if group.kind != 'country' and group.kind != 'chamber' %}
<td>
<a
href=
"{% chamber_url group.chamber %}"
>
{{ group.chamber|chamber_icon }}
</a>
</td>
{% endif %}
<td>
<a
href=
"{% group_url group %}"
>
{{ group.abbreviation }}
</a>
</td>
<td>
<a
href=
"{% group_url group %}"
>
{% if group.kind == 'chamber' %}
{{ group|chamber_icon }}
{% elif group.kind == 'country' %}
{{ group|country_flag }}
{% elif group.kind == 'group' %}
{{ group|group_long_icon }}
{% else %}
{{ group.name }}
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
{% endblock %}
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