wip-1.0-132 #133
							
								
								
									
										14
									
								
								aircox/templates/accounts/gestion.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								aircox/templates/accounts/gestion.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
{% extends "aircox/base.html" %}
 | 
			
		||||
{% load i18n aircox %}
 | 
			
		||||
 | 
			
		||||
{% block main %}
 | 
			
		||||
 | 
			
		||||
<h2>Mes émissions</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
{% for p in programs %}
 | 
			
		||||
<li><a href="{% url 'program-detail' slug=p.slug %}">{{ p.title }}</a></li>
 | 
			
		||||
{% endfor %}
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@ -68,6 +68,7 @@ Usefull context:
 | 
			
		||||
                        <div class="navbar-end">
 | 
			
		||||
                            {% block top-nav-tools %}
 | 
			
		||||
                            {% endblock %}
 | 
			
		||||
 | 
			
		||||
                            {% block top-nav-end %}
 | 
			
		||||
                            <div class="navbar-item">
 | 
			
		||||
                                <form action="{% url 'page-list' %}" method="GET">
 | 
			
		||||
@ -81,6 +82,13 @@ Usefull context:
 | 
			
		||||
                                </form>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            {% endblock %}
 | 
			
		||||
 | 
			
		||||
                            {% if user.is_authenticated %}
 | 
			
		||||
                                <a>{{ user.username }}!</a> <a href="{% url 'logout' %}"><i class="fa fa-sign-out"></i></a>
 | 
			
		||||
                                {% else %}
 | 
			
		||||
                                <!-- <a href="{% url 'login' %}"><i class="fa fa-unlock"></i></a> -->
 | 
			
		||||
                             {% endif %}
 | 
			
		||||
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								aircox/templates/registration/login.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								aircox/templates/registration/login.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
{% extends "aircox/base.html" %}
 | 
			
		||||
{% load i18n aircox %}
 | 
			
		||||
 | 
			
		||||
{% block main %}
 | 
			
		||||
 | 
			
		||||
<h2>{% trans "Log in" %}</h2>
 | 
			
		||||
<br/>
 | 
			
		||||
<form method="post">
 | 
			
		||||
  {% csrf_token %}
 | 
			
		||||
  <table>
 | 
			
		||||
  {{ form.as_table }}
 | 
			
		||||
  </table>
 | 
			
		||||
  <br/>
 | 
			
		||||
  <button type="submit">{% trans "Log in" %}</button>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
{{ block.super }}
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@ -117,4 +117,5 @@ urls = [
 | 
			
		||||
        views.errors.NoStationErrorView.as_view(),
 | 
			
		||||
        name="errors-no-station",
 | 
			
		||||
    ),
 | 
			
		||||
    path("gestion/", views.gestion, name="gestion"),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								aircox/views/gestion.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								aircox/views/gestion.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
from django.contrib.auth.decorators import login_required
 | 
			
		||||
from django.template.response import TemplateResponse
 | 
			
		||||
 | 
			
		||||
from aircox.models import Program
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
def gestion(request):
 | 
			
		||||
    programs = []
 | 
			
		||||
    ugroups = request.user.groups.all()
 | 
			
		||||
    for p in Program.objects.all():
 | 
			
		||||
        if p.editors in ugroups:
 | 
			
		||||
            programs.append(p)
 | 
			
		||||
    context = {"programs": programs}
 | 
			
		||||
    return TemplateResponse(request, "accounts/gestion.html", context)
 | 
			
		||||
@ -23,6 +23,7 @@ import aircox.urls
 | 
			
		||||
 | 
			
		||||
urlpatterns = aircox.urls.urls + [
 | 
			
		||||
    path("admin/", admin.site.urls),
 | 
			
		||||
    path("accounts/", include("django.contrib.auth.urls")),
 | 
			
		||||
    path("ckeditor/", include("ckeditor_uploader.urls")),
 | 
			
		||||
    path("filer/", include("filer.urls")),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user