Ajout d'options de personnalisation
This commit is contained in:
parent
1dd12ed438
commit
bda2980e1a
5 changed files with 74 additions and 1 deletions
28
settings/migrations/0002_auto_20180301_1047.py
Normal file
28
settings/migrations/0002_auto_20180301_1047.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 2.0.1 on 2018-03-01 10:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('settings', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='sitesettings',
|
||||
name='event_poster',
|
||||
field=models.ImageField(null=True, upload_to='', verbose_name="Affiche de l'événement"),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='sitesettings',
|
||||
name='min_number_of_categories',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='Nombre minimal de catégories dans laquelle participer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='sitesettings',
|
||||
name='site_logo',
|
||||
field=models.ImageField(null=True, upload_to='', verbose_name='Logo du site'),
|
||||
),
|
||||
]
|
|
@ -13,6 +13,18 @@ class SiteSettings(models.Model):
|
|||
verbose_name="Message de la page d'accueil",
|
||||
default=""
|
||||
)
|
||||
site_logo = models.ImageField(
|
||||
verbose_name="Logo du site",
|
||||
null=True
|
||||
)
|
||||
event_poster = models.ImageField(
|
||||
verbose_name="Affiche de l'événement",
|
||||
null=True
|
||||
)
|
||||
min_number_of_categories = models.PositiveIntegerField(
|
||||
verbose_name="Nombre minimal de catégories dans laquelle participer",
|
||||
default=0,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_settings(cls):
|
||||
|
|
|
@ -82,5 +82,29 @@
|
|||
<th>Message d'accueil</th>
|
||||
<td>{{site_settings.home_message}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Logo du site</th>
|
||||
<td>
|
||||
{% if site_settings.site_logo %}
|
||||
<img src="{{ site_settings.site_logo.url }}" alt="logo"/>
|
||||
{% else %}
|
||||
Pas de logo
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Affiche de l'événement</th>
|
||||
<td>
|
||||
{% if site_settings.event_poster %}
|
||||
<img src="{{ site_settings.event_poster.url }}" alt="affiche"/>
|
||||
{% else %}
|
||||
Pas d'affiche
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nombre minimal de catégories</th>
|
||||
<td>{{ site_settings.min_number_of_categories }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,4 +7,5 @@ def home(request):
|
|||
return render(request, "home.html", {
|
||||
'upload_allowed': settings.allow_upload,
|
||||
'message': settings.home_message,
|
||||
'poster': settings.event_poster,
|
||||
})
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
{% load categories %}
|
||||
{% load load_settings %}
|
||||
{% load_categories %}
|
||||
{% load_site_settings %}
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<a class="navbar-brand" href="{% url "home"%}">Il était une fois dans l'est</a>
|
||||
<a class="navbar-brand" href="{% url "home"%}">
|
||||
{% if site_settings.site_logo %}
|
||||
<img src="{{ site_settings.site_logo.url}}"/>
|
||||
{% else %}
|
||||
Il était une fois dans l'est
|
||||
{% endif %}
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
|
Loading…
Reference in a new issue