5 changed files with 81 additions and 9 deletions
@ -1,11 +1,62 @@ |
|||||
{% extends "base.html" %} |
{% extends "base.html" %} |
||||
|
{% block content %} |
||||
<h1>Page d'administration du site</h1> |
<h1>Page d'administration du site</h1> |
||||
<h2>Liste des catégories</h2> |
<h2>Liste des catégories</h2> |
||||
<a href="{% url 'content:category-new' %}">Créer une nouvelle catégorie</a> |
<a class="btn btn-primary btn-sm" role="button" href="{% url 'content:category-new' %}"> |
||||
<ul> |
<i class="glyphicon glyphicon-plus"></i> |
||||
{% for c in categories %} |
Créer une nouvelle catégorie |
||||
<li>c.name</li> |
</a> |
||||
{% endfor %} |
<table class="table table-striped"> |
||||
</ul> |
<tr> |
||||
|
<th>Nom de la catégorie</th> |
||||
|
<th>Nombre de contenus</th> |
||||
|
<th></th> |
||||
|
</tr> |
||||
|
{% for c in categories %} |
||||
|
<tr> |
||||
|
<td><a href="{{c.get_absolute_url}}">{{c.name}}</a></td> |
||||
|
<td>{{c.content_set.count}}</td> |
||||
|
<td><a href="">Éditer</a></td> |
||||
|
</tr> |
||||
|
{% endfor %} |
||||
|
</table> |
||||
|
|
||||
<h2>Réglages</h2> |
<h2>Réglages</h2> |
||||
|
<h3>Réglages du site</h3> |
||||
|
<a class="btn btn-primary btn-sm" href=""> |
||||
|
<i class="glyphicon glyphicon-edit"></i> |
||||
|
Éditer |
||||
|
</a> |
||||
|
<table class="table table-striped"> |
||||
|
<tr> |
||||
|
<th>Upload</th> |
||||
|
<td> |
||||
|
{% if site_settings.allow_upload %} |
||||
|
Autorisé |
||||
|
{% else %} |
||||
|
Non autorisé |
||||
|
{% endif %} |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>Message d'accueil</th> |
||||
|
<td>{{site_settings.home_message}}</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
|
||||
|
<h3>Réglage du contenu</h3> |
||||
|
<a class="btn btn-primary btn-sm" href=""> |
||||
|
<i class="glyphicon glyphicon-edit"></i> |
||||
|
Éditer |
||||
|
</a> |
||||
|
<table class="table table-striped"> |
||||
|
<tr> |
||||
|
<th>URL du FTP</th> |
||||
|
<td>{{content_settings.ftp_url}}</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>Identifiant du FTP</th> |
||||
|
<td>{{content_settings.ftp_id}}</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
{% endblock %} |
||||
|
|||||
@ -0,0 +1,11 @@ |
|||||
|
from django.urls import path |
||||
|
from .views import SettingsView |
||||
|
|
||||
|
app_name = 'settings' |
||||
|
urlpatterns = [ |
||||
|
path( |
||||
|
'', |
||||
|
SettingsView.as_view(), |
||||
|
name='index' |
||||
|
), |
||||
|
] |
||||
@ -1,3 +1,12 @@ |
|||||
from django.shortcuts import render |
from django.views.generic import TemplateView |
||||
|
from content.models import Category |
||||
|
from .models import ContentSettings, SiteSettings |
||||
|
|
||||
# Create your views here. |
class SettingsView(TemplateView): |
||||
|
template_name = "settings/settings.html" |
||||
|
def get_context_data(self, **kwargs): |
||||
|
context = super().get_context_data(**kwargs) |
||||
|
context['categories'] = Category.objects.all() |
||||
|
context['site_settings'],_ = SiteSettings.objects.get_or_create() |
||||
|
context['content_settings'],_ = ContentSettings.objects.get_or_create() |
||||
|
return context |
||||
|
|||||
Loading…
Reference in new issue