Commit d4aaf49f authored by fred's avatar fred

real user facing frontend

parent a6638edb
......@@ -80,6 +80,18 @@ class Emission(models.Model):
def get_schedules(self):
return Schedule.objects.filter(emission=self).order_by('datetime')
def get_sorted_emissions(self):
return self.episode_set.select_related().extra(select={
'first_diffusion': 'emissions_diffusion.datetime',
},
select_params=(False, True),
where=['''datetime = (SELECT MIN(datetime)
FROM emissions_diffusion
WHERE episode_id = emissions_episode.id)'''],
tables=['emissions_diffusion'],
).order_by('-first_diffusion')
class Schedule(models.Model, WeekdayMixin):
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block appbar %}
<h2>Émissions</h2>
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block appbar %}
<h2>Émissions</h2>
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block appbar %}
<h2>{{ emission.title }}
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block extrascripts %}
<script src="{{ STATIC_URL }}ckeditor/ckeditor/ckeditor.js">
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block appbar %}
<h2>Émissions</h2>
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block appbar %}
<h2>{{ episode.emission.title }} — {{ episode.title }}</h2>
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block extrascripts %}
<script src="{{ STATIC_URL }}ckeditor/ckeditor/ckeditor.js">
......
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% block extrascripts %}
<script src="{{ STATIC_URL }}ckeditor/ckeditor/ckeditor.js">
......
......@@ -355,6 +355,21 @@ ul.episode-list {
border-width: 1px 0;
}
a.big-friendly-button {
text-decoration: none;
display: inline-block;
padding: 1ex;
margin: 0 1em;
color: #ffffff;
background: #4690d6;
border: 1px solid #2a567f;
font-weight: bold;
}
a.big-friendly-button:hover {
background: #2a567f;
}
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: FontAwesome;
font-weight: normal;
......
{% extends "base.html" %}
{% block content %}
{% for emission in emissions %}
<h2>{{ emission.title }}</h2>
<a class="big-friendly-button" href="{% url 'episode-add' emission_slug=emission.slug %}">Ajouter un épisode</a>
<a class="big-friendly-button" href="#">Ajouter une actu</a>
<a class="big-friendly-button" href="{% url 'emission-update' slug=emission.slug %}">Modifier description / image / etc.</a>
<h4>Épisodes récents</h4>
<ul class="episode-list">
{% for episode in emission.get_sorted_emissions|slice:":10" %}
<li>{{ episode.diffusion_set.all.0.datetime|date:"d E o H:i"|lower }}
<br/>   <a href="{% url 'episode-view' emission_slug=emission.slug slug=episode.slug %}">{{ episode.title }}</a>
{% if episode.has_sound %}<span class="icon-music"/>{%endif%}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endblock %}
{% extends "panikdb/base.html" %}
{% extends "base.html" %}
{% load url from future %}
{% block content %}
......
{% extends 'panikdb/base.html' %}
{% extends 'base.html' %}
{% block content %}
<h2>Recherche</h2>
......
......@@ -20,10 +20,11 @@ from urls_utils import decorated_includes
sqs = SearchQuerySet().facet('categories').facet('tags')
urlpatterns = patterns('',
url(r'^$', RedirectView.as_view(url=reverse_lazy('emission-list'))),
url(r'^$', 'panikdb.views.home', name='home'),
(r'^ckeditor/', include('ckeditor.urls')),
url(r'^search/', search_view_factory(view_class=FacetedSearchView,
form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),
url(r'^emissions/$', RedirectView.as_view(url=reverse_lazy('home'))),
url(r'^emissions/',
decorated_includes(login_required, include(emissions_urlpatterns))),
......
from django.contrib.auth.decorators import login_required
from django.views.generic.base import TemplateView
from emissions.models import Emission
class Home(TemplateView):
template_name = 'home.html'
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['emissions'] = self.request.user.emissions.all()
return context
home = login_required(Home.as_view())
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