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

Remove dossier ref from position

Adds tag instead
parent e571ce4c
......@@ -61,7 +61,9 @@
%a{:href => '{% url "positions:position-detail" position.pk %}'}
=position.text|truncatewords:8
%td
= position.dossier
- for tag in position.tags.all
%span.label.label-default
= tag
%td
%a{:href => '{{position.link}}'}
= position.link
......
......@@ -16,11 +16,13 @@
# If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
from __future__ import absolute_import
from django.conf.urls import url
from views import representative
from views import group
from .views import representative
from .views import group
urlpatterns = [
# List of groups by group kind
......
......@@ -65,12 +65,14 @@ INSTALLED_APPS = (
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
# 3rd party app
# 3rd party apps
'compressor',
'adminplus',
'constance',
'bootstrap3',
'datetimewidget',
'django_filters',
'taggit',
# ---
'core',
'representatives',
......
......@@ -41,7 +41,7 @@ unpublish_positions.short_description = 'Unpublish selected positions'
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_editable = ('published',)
list_filter = ('published',)
......
......@@ -22,13 +22,12 @@ from django import forms
from datetimewidget.widgets import DateWidget
from votes.models import MemopolDossier
from .models import Position
class PositionForm(forms.ModelForm):
class Meta:
model = Position
fields = ['dossier', 'datetime', 'text', 'link']
fields = ['tags', 'datetime', 'text', 'link']
widgets = {
#Use localization and bootstrap 3
'datetime': DateWidget(
......@@ -39,8 +38,3 @@ class PositionForm(forms.ModelForm):
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
from django.template.defaultfilters import truncatewords
from constance import config
from taggit.managers import TaggableManager
from legislature.models import MemopolRepresentative
from votes.models import MemopolDossier
class PositionManager(models.Manager):
......@@ -39,11 +39,11 @@ class PositionManager(models.Manager):
class Position(models.Model):
representative = models.ForeignKey(MemopolRepresentative, related_name='positions')
dossier = models.ForeignKey(MemopolDossier, null=True, blank=True)
datetime = models.DateField()
text = models.TextField()
link = models.URLField()
published = models.BooleanField(default=False)
tags = TaggableManager()
# Adds our custom manager
objects = PositionManager()
......
......@@ -3,15 +3,18 @@
- load humanize
- block content
- include 'legislature/blocks/representative_header.html' with representative=object.representative
- include 'legislature/blocks/representative_block.html' with representative=object.representative
.quote
%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
= object.text|linebreaks
%p.tags
- for tag in object.tags.all
%span.label.label-default
= tag
%p
Source :
%a{:href => '{{object.link}}'}
......
......@@ -20,4 +20,8 @@ body {
.label a {
color: white;
}
.label {
margin: 0 1px;
}
\ No newline at end of file
......@@ -34,4 +34,31 @@
.vote_abstain {
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 @@
width: 70%;
margin: auto;
font-family: 'Linux Libertine', serif;
font-size: 1.5em;
}
.quote-header {
......
......@@ -112,11 +112,30 @@ table.detail-view th:after {
.vote_abstain {
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 {
width: 70%;
margin: auto;
font-family: 'Linux Libertine', serif;
font-size: 1.5em;
}
.quote-header {
font-style: italic;
......@@ -145,3 +164,6 @@ body {
.label a {
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