Compare commits

..

9 Commits

5 changed files with 23 additions and 11 deletions

View File

@ -6,10 +6,23 @@
{% endblock %}
{% block main %}
<h2 class="subtitle is-3">Mes émissions</h2>
<h2 class="subtitle is-3">{% trans 'My programs' %}</h2>
{% if programs|length %}
<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,3 +1,4 @@
{% load static i18n thumbnail aircox %}<!doctype html>
{% comment %}
Base website template. It displays various elements depending on context
variables.
@ -10,8 +11,6 @@ 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,8 +18,7 @@ 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="new">
<a class="navbar-item" href="{% url 'program-edit' page.pk %}" target="_self">
<span class="icon is-small">
<i class="fa fa-pen"></i>
</span>&nbsp;

View File

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

View File

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