Commit ea84bcb7 authored by njoyard's avatar njoyard Committed by GitHub

Merge pull request #123 from political-memory/themes

Add themes
parents 69861a94 b6432187
...@@ -11,6 +11,7 @@ from django_filters import FilterSet, MethodFilter, ModelChoiceFilter ...@@ -11,6 +11,7 @@ from django_filters import FilterSet, MethodFilter, ModelChoiceFilter
from representatives.models import Chamber, Group, Representative from representatives.models import Chamber, Group, Representative
from representatives_votes.models import Dossier from representatives_votes.models import Dossier
from memopol_themes.models import Theme
def rep_chamber_filter(qs, value): def rep_chamber_filter(qs, value):
...@@ -77,3 +78,19 @@ class DossierFilter(FilterSet): ...@@ -77,3 +78,19 @@ class DossierFilter(FilterSet):
return qs.filter(Q(title__icontains=value) | return qs.filter(Q(title__icontains=value) |
Q(reference__icontains=value)) Q(reference__icontains=value))
class ThemeFilter(FilterSet):
search = MethodFilter(action='search_filter')
class Meta:
model = Theme
fields = ['search']
def search_filter(self, qs, value):
if len(value) == 0:
return qs
return qs.filter(Q(name__icontains=value) |
Q(description__icontains=value))
...@@ -1084,82 +1084,13 @@ ...@@ -1084,82 +1084,13 @@
"model": "representatives_recommendations.recommendation", "model": "representatives_recommendations.recommendation",
"pk": 47 "pk": 47
}, },
{
"fields": {
"name": "acta",
"slug": "acta"
},
"model": "taggit.tag",
"pk": 1
},
{
"fields": {
"name": "foo",
"slug": "foo"
},
"model": "taggit.tag",
"pk": 2
},
{
"fields": {
"name": "bar",
"slug": "bar"
},
"model": "taggit.tag",
"pk": 3
},
{ {
"fields": { "fields": {
"model": "position", "model": "position",
"app_label": "representatives_positions" "app_label": "representatives_positions"
}, },
"model": "contenttypes.contenttype", "model": "contenttypes.contenttype",
"pk": 29 "pk": 31
},
{
"fields": {
"tag": 1,
"object_id": 1,
"content_type": 29
},
"model": "taggit.taggeditem",
"pk": 1
},
{
"fields": {
"tag": 2,
"object_id": 1,
"content_type": 29
},
"model": "taggit.taggeditem",
"pk": 2
},
{
"fields": {
"tag": 1,
"object_id": 3,
"content_type": 29
},
"model": "taggit.taggeditem",
"pk": 5
},
{
"fields": {
"tag": 1,
"object_id": 2,
"content_type": 29
},
"model": "taggit.taggeditem",
"pk": 6
},
{
"fields": {
"tag": 3,
"object_id": 2,
"content_type": 29
},
"model": "taggit.taggeditem",
"pk": 7
}, },
{ {
"fields": { "fields": {
......
...@@ -23200,5 +23200,32 @@ ...@@ -23200,5 +23200,32 @@
}, },
"model": "representatives_recommendations.recommendation", "model": "representatives_recommendations.recommendation",
"pk": 47 "pk": 47
},
{
"fields": {
"description": "The Anti-Counterfeiting Trade agreement is a really bad thing, we would like to kill it with fire.",
"positions": [
],
"proposals": [
5744, 5745, 5746
],
"dossiers": [
28147
],
"slug": "acta",
"name": "acta"
},
"model": "memopol_themes.theme",
"pk": 1
},
{
"fields": {
"theme": 1,
"datetime": "2008-01-01",
"link": "http://www.laquadrature.net",
"title": "Press release on ACTA from La Quadrature du Net"
},
"model": "memopol_themes.themelink",
"pk": 1
} }
] ]
...@@ -91,6 +91,7 @@ INSTALLED_APPS = ( ...@@ -91,6 +91,7 @@ INSTALLED_APPS = (
'core', 'core',
'memopol', 'memopol',
'memopol_settings', 'memopol_settings',
'memopol_themes',
'representatives', 'representatives',
'representatives_votes', 'representatives_votes',
'representatives_recommendations', 'representatives_recommendations',
......
...@@ -10,17 +10,6 @@ ...@@ -10,17 +10,6 @@
first-validated first-validated
</a> </a>
</td> </td>
<td>
<span class='label label-default'>
acta
</span>
<span class='label label-default'>
bar
</span>
</td>
<td> <td>
<a href='http://example.com/first-validated'> <a href='http://example.com/first-validated'>
http://example.com/first-validated http://example.com/first-validated
...@@ -36,13 +25,6 @@ ...@@ -36,13 +25,6 @@
other-validated other-validated
</a> </a>
</td> </td>
<td>
<span class='label label-default'>
acta
</span>
</td>
<td> <td>
<a href='http://example.com/second-validated'> <a href='http://example.com/second-validated'>
http://example.com/second-validated http://example.com/second-validated
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -65,6 +65,11 @@ ...@@ -65,6 +65,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>
<li>
<a href='/theme/'>
Themes
</a>
</li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Dossiers Dossiers
......
...@@ -74,6 +74,11 @@ ...@@ -74,6 +74,11 @@
Committees Committees
</a> </a>
</li> </li>