Compare commits

..

7 Commits

5 changed files with 11 additions and 23 deletions

View File

@ -6,23 +6,10 @@
{% endblock %}
{% block main %}
<h2 class="subtitle is-3">{% trans 'My programs' %}</h2>
{% if programs|length %}
<h2 class="subtitle is-3">Mes émissions</h2>
<ul>
{% for p in programs %}
<li><a href="{% url 'program-detail' slug=p.slug %}">{{ p.title }}</a></li>
{% endfor %}
</ul>
<br />
<h2 class="subtitle is-3">{% trans 'Episodes' %}</h2>
{% for e in episodes %}
<ul>
<li><a href="{% url 'episode-detail' slug=e.slug %}">{{ e.title }}</a></li>
</ul>
{% endfor %}
{% else %}
{% trans 'You are not listed as a program editor yet' %}
{% endif %}
{% endblock %}

View File

@ -1,4 +1,3 @@
{% load static i18n thumbnail aircox %}<!doctype html>
{% comment %}
Base website template. It displays various elements depending on context
variables.
@ -11,6 +10,8 @@ Usefull context:
- sidebar_url_name: url name sidebar item complete list
- sidebar_url_parent: parent page for sidebar items complete list
{% endcomment %}
{% load static i18n thumbnail aircox %}
<html>
<head>
<meta charset="utf-8" />

View File

@ -18,7 +18,8 @@ Context:
{% block top-nav-tools %}
{% has_perm page page.change_permission_codename simple=True as can_edit %}
{% if can_edit %}
<a class="navbar-item" href="{% url 'program-edit' page.pk %}" target="_self">
<a class="navbar-item" href="{% url 'program-edit' page.pk %}"
target="new">
<span class="icon is-small">
<i class="fa fa-pen"></i>
</span>&nbsp;

View File

@ -10,7 +10,8 @@
{% endblock %}
{% block top-nav-tools %}
<a class="navbar-item" href="{% url 'program-detail' object.slug %}" target="_self">
<a class="navbar-item" href="{% url 'program-detail' object.slug %}"
target="new">
<span class="icon is-small">
<i class="fa fa-eye"></i>
</span>&nbsp;
@ -19,7 +20,7 @@
{% endblock %}
{% block main %}
<form method="post" enctype="multipart/form-data">{% csrf_token %}
<form method="post">{% csrf_token %}
<table>
{{ form.as_table }}
{% render_honeypot_field "website" %}

View File

@ -1,17 +1,15 @@
from django.contrib.auth.decorators import login_required
from django.template.response import TemplateResponse
from aircox.models import Episode, Program
from aircox.models import Program
@login_required
def profile(request):
programs, episodes = [], []
programs = []
ugroups = request.user.groups.all()
for p in Program.objects.all():
if p.editors in ugroups:
programs.append(p)
for e in Episode.objects.filter(parent=p):
episodes.append(e)
context = {"user": request.user, "programs": programs, "episodes": episodes}
context = {"user": request.user, "programs": programs}
return TemplateResponse(request, "accounts/profile.html", context)