Commit cf0f9775 authored by sberna's avatar sberna

Added models Reuse and Workshop/2

parent e46a271a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-07-09 09:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('opencoesione', '0017_auto_20200707_1144'),
]
operations = [
migrations.AlterModelOptions(
name='reuse',
options={'ordering': ['-date', 'priority', '-pk'], 'verbose_name': 'esperienza di riuso', 'verbose_name_plural': 'esperienze di riuso'},
),
migrations.AlterModelOptions(
name='workshop',
options={'ordering': ['-date', 'priority', '-pk'], 'verbose_name': 'esperienza di laboratorio', 'verbose_name_plural': 'esperienze di laboratorio'},
),
migrations.AddField(
model_name='reuse',
name='date',
field=models.DateField(default=django.utils.timezone.now, verbose_name='data'),
),
migrations.AddField(
model_name='workshop',
name='date',
field=models.DateField(default=django.utils.timezone.now, verbose_name='data'),
),
]
......@@ -169,29 +169,33 @@ class BaseItem(models.Model):
class Meta:
abstract = True
ordering = ['priority', '-pk']
class Event(BaseItem):
class Meta(BaseItem.Meta):
verbose_name = _('evento/riunione')
verbose_name_plural = _('eventi/riunioni')
ordering = ['priority', '-pk']
class Reuse(BaseItem):
date = models.DateField(default=now, verbose_name=_('data'))
documents = GenericRelation(File, verbose_name=_('documenti'))
class Meta(BaseItem.Meta):
verbose_name = _('esperienza di riuso')
verbose_name_plural = _('esperienze di riuso')
ordering = ['-date', 'priority', '-pk']
class Workshop(BaseItem):
date = models.DateField(default=now, verbose_name=_('data'))
documents = GenericRelation(File, verbose_name=_('documenti'))
class Meta(BaseItem.Meta):
verbose_name = _('esperienza di laboratorio')
verbose_name_plural = _('esperienze di laboratorio')
ordering = ['-date', 'priority', '-pk']
class FAQ(models.Model):
......
......@@ -11,7 +11,7 @@
{% endblock %}
{% block content %}
<div class="container">
<div id="item-list" class="container">
<div class="row">
<div class="col-md-8">
{% if flatpage.content %}
......@@ -21,14 +21,19 @@
{% endif %}
{% for object in object_list %}
<div class="item" style="margin-top: 40px">
<div class="item">
<div class="date">{{ object.date|date:'d/m/Y' }}</div>
<h3 style="margin-bottom: 0; padding-bottom: 8px; border-bottom: 1px solid #CECECE">{{ object }}</h3>
{{ object.body|safe }}
<ul style="list-style: none; margin: 0; padding: 0">
<table class="table">
{% for document in object.documents.all %}
<li style="margin-top: 10px"><a class="download" href="{{ document.file.url }}">{% trans 'Scarica il' %} {{ document.file.name|slice:'-3:'|lower }} ({{ document.file.size|filesizeformat }})</a></li>
<tr>
<td style="vertical-align: middle; border-color: #CECECE">{{ document.description }}</td>
<td style="vertical-align: middle; border-color: #CECECE"><a class="download" href="{{ document.file.url }}">{% trans 'Scarica il' %} {{ document.file.name|slice:'-3:'|lower }} ({{ document.file.size|filesizeformat }})</a></td>
</tr>
{% endfor %}
</ul>
</table>
</div>
{% endfor %}
......
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