Commit 825e5013 authored by Arnaud Fabre's avatar Arnaud Fabre
Browse files

Remove dossier ref from position

Adds tag instead
parent e571ce4c
...@@ -61,7 +61,9 @@ ...@@ -61,7 +61,9 @@
%a{:href => '{% url "positions:position-detail" position.pk %}'} %a{:href => '{% url "positions:position-detail" position.pk %}'}
=position.text|truncatewords:8 =position.text|truncatewords:8
%td %td
= position.dossier - for tag in position.tags.all
%span.label.label-default
= tag
%td %td
%a{:href => '{{position.link}}'} %a{:href => '{{position.link}}'}
= position.link = position.link
......
...@@ -16,11 +16,13 @@ ...@@ -16,11 +16,13 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net> # Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
from __future__ import absolute_import
from django.conf.urls import url from django.conf.urls import url
from views import representative from .views import representative
from views import group from .views import group
urlpatterns = [ urlpatterns = [
# List of groups by group kind # List of groups by group kind
......
...@@ -65,12 +65,14 @@ INSTALLED_APPS = ( ...@@ -65,12 +65,14 @@ INSTALLED_APPS = (
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django.contrib.humanize', 'django.contrib.humanize',
# 3rd party app # 3rd party apps
'compressor', 'compressor',
'adminplus', 'adminplus',
'constance', 'constance',
'bootstrap3', 'bootstrap3',
'datetimewidget', 'datetimewidget',
'django_filters',
'taggit',
# --- # ---
'core', 'core',
'representatives', 'representatives',
......
...@@ -41,7 +41,7 @@ unpublish_positions.short_description = 'Unpublish selected positions' ...@@ -41,7 +41,7 @@ unpublish_positions.short_description = 'Unpublish selected positions'
class PositionAdmin(admin.ModelAdmin): class PositionAdmin(admin.ModelAdmin):
list_display = ('representative', 'short_text', 'dossier', 'datetime', 'link', 'published') list_display = ('representative', 'short_text', 'datetime', 'link', 'published')
list_display_links = ('short_text',) list_display_links = ('short_text',)
list_editable = ('published',) list_editable = ('published',)
list_filter = ('published',) list_filter = ('published',)
......
...@@ -22,13 +22,12 @@ from django import forms ...@@ -22,13 +22,12 @@ from django import forms
from datetimewidget.widgets import DateWidget from datetimewidget.widgets import DateWidget
from votes.models import MemopolDossier
from .models import Position from .models import Position
class PositionForm(forms.ModelForm): class PositionForm(forms.ModelForm):
class Meta: class Meta:
model = Position model = Position
fields = ['dossier', 'datetime', 'text', 'link'] fields = ['tags', 'datetime', 'text', 'link']
widgets = { widgets = {
#Use localization and bootstrap 3 #Use localization and bootstrap 3
'datetime': DateWidget( 'datetime': DateWidget(
...@@ -39,8 +38,3 @@ class PositionForm(forms.ModelForm): ...@@ -39,8 +38,3 @@ class PositionForm(forms.ModelForm):
bootstrap_version=3, bootstrap_version=3,
) )
} }
dossier = forms.ModelChoiceField(
queryset=MemopolDossier.objects.all(),
required=False
)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0001_initial'),
('positions', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='position',
name='dossier',
),
migrations.AddField(
model_name='position',
name='tags',
field=taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', help_text='A comma-separated list of tags.', verbose_name='Tags'),
),
]
...@@ -22,9 +22,9 @@ from django.db import models ...@@ -22,9 +22,9 @@ from django.db import models
from django.template.defaultfilters import truncatewords from django.template.defaultfilters import truncatewords
from constance import config from constance import config
from taggit.managers import TaggableManager
from legislature.models import MemopolRepresentative from legislature.models import MemopolRepresentative
from votes.models import MemopolDossier
class PositionManager(models.Manager): class PositionManager(models.Manager):
...@@ -39,11 +39,11 @@ class PositionManager(models.Manager): ...@@ -39,11 +39,11 @@ class PositionManager(models.Manager):
class Position(models.Model): class Position(models.Model):
representative = models.ForeignKey(MemopolRepresentative, related_name='positions') representative = models.ForeignKey(MemopolRepresentative, related_name='positions')
dossier = models.ForeignKey(MemopolDossier, null=True, blank=True)
datetime = models.DateField() datetime = models.DateField()
text = models.TextField() text = models.TextField()
link = models.URLField() link = models.URLField()
published = models.BooleanField(default=False) published = models.BooleanField(default=False)
tags = TaggableManager()
# Adds our custom manager # Adds our custom manager
objects = PositionManager() objects = PositionManager()
......
...@@ -3,15 +3,18 @@ ...@@ -3,15 +3,18 @@
- load humanize - load humanize
- block content - block content
- include 'legislature/blocks/representative_header.html' with representative=object.representative - include 'legislature/blocks/representative_block.html' with representative=object.representative
.quote .quote
%p.quote-header %p.quote-header
The {{object.datetime|naturalday:"d/m/Y"}}, {{object.representative.full_name}} declared : {{object.datetime|naturalday:"The d/m/Y"}}, {{object.representative.full_name}} declared :
.long-quote .long-quote
= object.text|linebreaks = object.text|linebreaks
%p.tags
- for tag in object.tags.all
%span.label.label-default
= tag
%p %p
Source : Source :
%a{:href => '{{object.link}}'} %a{:href => '{{object.link}}'}
......
...@@ -20,4 +20,8 @@ body { ...@@ -20,4 +20,8 @@ body {
.label a { .label a {
color: white; color: white;
}
.label {
margin: 0 1px;
} }
\ No newline at end of file
...@@ -34,4 +34,31 @@ ...@@ -34,4 +34,31 @@
.vote_abstain { .vote_abstain {
color: #333; color: #333;
}
.representative_grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
.representative_item {
width: 300px;
margin: 2px;
padding: 10px;
// border: 1px solid black;
background: #f5f5f5;
.photo {
float: left;
}
.name {
font-weight: bold;
}
ul {
list-style-type: none;
text-indent: 10px;
}
}
} }
\ No newline at end of file
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
width: 70%; width: 70%;
margin: auto; margin: auto;
font-family: 'Linux Libertine', serif;
font-size: 1.5em;
} }
.quote-header { .quote-header {
......
...@@ -112,11 +112,30 @@ table.detail-view th:after { ...@@ -112,11 +112,30 @@ table.detail-view th:after {
.vote_abstain { .vote_abstain {
color: #333; color: #333;
} }
.representative_grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.representative_grid .representative_item {
width: 300px;
margin: 2px;
padding: 10px;
background: #f5f5f5;
}
.representative_grid .representative_item .photo {
float: left;
}
.representative_grid .representative_item .name {
font-weight: bold;
}
.representative_grid .representative_item ul {
list-style-type: none;
text-indent: 10px;
}
.quote { .quote {
width: 70%; width: 70%;
margin: auto; margin: auto;
font-family: 'Linux Libertine', serif;
font-size: 1.5em;
} }
.quote-header { .quote-header {
font-style: italic; font-style: italic;
...@@ -145,3 +164,6 @@ body { ...@@ -145,3 +164,6 @@ body {
.label a { .label a {
color: white; color: white;
} }
.label {
margin: 0 1px;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment