calendar; init rel_post issue

This commit is contained in:
bkfox 2016-06-29 02:23:56 +02:00
parent 3d8abd9df8
commit dd2ccac3c0
6 changed files with 86 additions and 13 deletions

View File

@ -1,4 +1,3 @@
import uuid
import inspect
from django.template.loader import render_to_string

View File

@ -190,7 +190,7 @@ class Post (models.Model, Routable):
if not self.title:
self.title = _('{name} // {date}').format(
name = self.thread.title,
date = self.date
date = self.date.strftime('%d %B %Y')
)
if not self.content:
self.content = self.thread.content

View File

@ -530,9 +530,9 @@ class Calendar(Section):
) for day in range(1, count+1)
],
'month': date,
'today': tz.datetime.today(),
'prev_month': date - tz.timedelta(days=10),
'next_month': date + tz.timedelta(days=31),
'next_month': date + tz.timedelta(days=count),
})
return context

View File

@ -80,5 +80,76 @@ main .section {
}
/** calendar **/
.section_calendar header {
border-bottom: 1px black solid;
width: 100%;
}
.section_calendar header h3,
.section_calendar header a {
display: inline-block;
width: 2em;
padding: 0;
margin: 0;
font-size: 1em;
}
.section_calendar header h3 {
width: calc(100% - 4em);
text-align: center;
}
.section_calendar header a:last-child {
text-align: right;
}
.section_calendar .content {
padding: 0.2em;
margin: 0;
font-size: 0.9em;
}
.section_calendar .content > * {
padding: 0;
margin: 0;
text-align: right;
display: inline-block;
}
.section_calendar .content a {
width: calc(100% / 7);
}
.section_calendar .content a.today {
font-style: italic;
}
.section_calendar div[first_weekday] {
width: 0;
}
.section_calendar div[first_weekday="1"] {
width: calc(100% / 7);
}
.section_calendar div[first_weekday="2"] {
width: calc(100% / 7 * 2);
}
.section_calendar div[first_weekday="3"] {
width: calc(100% / 7 * 3);
}
.section_calendar div[first_weekday="4"] {
width: calc(100% / 7 * 4);
}
.section_calendar div[first_weekday="5"] {
width: calc(100% / 7 * 5);
}
.section_calendar div[first_weekday="6"] {
width: calc(100% / 7 * 6);
}

View File

@ -1,25 +1,28 @@
{% extends "aircox/cms/website.html" %}
{% block header %}
{% spaceless %}
<header>
<a href="{% url exp.name key="render" year=prev_month.year month=prev_month.month %}"
onclick="return Section.load_event(event);">&lt;</a>
<time>{{ month|date:'F Y' }}</time>
<h3>{{ today|date:'F Y' }}</h3>
<a href="{% url exp.name key="render" year=next_month.year month=next_month.month %}"
onclick="return Section.load_event(event);">&gt;</a>
</header>
{% endspaceless %}
{% endblock %}
{% block content %}
{% spaceless %}
<div class="content">
<div first_weekday="{{ first_weekday }}">
{% for day, url in days %}
<a href="{{ url }}">{{ day }}</a>
{% endfor %}
</div>
<div first_weekday="{{ first_weekday }}">&nbsp;</div>
{% for day, url in days %}
<a href="{{ url }}" {% if day == today.day %}class="today"{% endif %}>{{ day }}</a>
{% endfor %}
</div>
{% endspaceless %}
{% endblock %}

View File

@ -26,12 +26,13 @@
- cms.exposure; make it right, see nomenclature, + docstring
- admin cms
- sections:
- calendar
- article list with the focus
-> set html attribute based on values that are public
- website:
- strftime on diffusion default name from related model
- diff post init:
- strftime on title
- image?
- render schedule does not get the correct list
- diffusions:
- filter sounds for undiffused diffusions
@ -41,7 +42,6 @@
- "listen" + "favorite" buttons made easy + automated
- mixcloud
- seek bar
- load complete week for a schedule?
- list of played diffusions and tracks when non-stop;