Page d'administration.
This commit is contained in:
parent
861a747b0b
commit
ce151d0f57
5 changed files with 81 additions and 9 deletions
|
@ -1,11 +1,62 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Page d'administration du site</h1>
|
||||
<h2>Liste des catégories</h2>
|
||||
<a href="{% url 'content:category-new' %}">Créer une nouvelle catégorie</a>
|
||||
<ul>
|
||||
{% for c in categories %}
|
||||
<li>c.name</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'content:category-new' %}">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
Créer une nouvelle catégorie
|
||||
</a>
|
||||
<table class="table table-striped">
|
||||
<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>
|
||||
<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 %}
|
||||
|
|
11
settings/urls.py
Normal file
11
settings/urls.py
Normal file
|
@ -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
|
||||
|
|
|
@ -22,4 +22,5 @@ urlpatterns = [
|
|||
path('admin/', admin.site.urls),
|
||||
path('', views.home),
|
||||
path('content/', include('content.urls')),
|
||||
path('settings/', include('settings.urls')),
|
||||
]
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</a></li>
|
||||
{% endfor %}
|
||||
<li><a href="">Vote</a></li>
|
||||
<li><a href="{% url 'content:category-new' %}">Nouvelle catégorie</a></li>
|
||||
<li><a href="{% url 'settings:index' %}">Administration</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
|
Loading…
Reference in a new issue