Compare commits

...

4 Commits

Author SHA1 Message Date
d03d2f3371 fix plusieurs contats page salle 2019-09-08 16:52:14 +02:00
e78ae9e05d ajout plusieurs illustrations par évenement 2019-09-08 16:51:49 +02:00
6f51c60335 lien admin Django centré 2019-09-08 15:15:34 +02:00
ea06c6b9f7 maj bootstrap 2019-09-08 15:15:06 +02:00
10 changed files with 128 additions and 50 deletions

View File

@ -1,17 +1,25 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation rec {
name= "site-musique";
pkgs.python3.pkgs.buildPythonPackage rec {
pname= "site-musique";
version = "1.0";
inherit (pkgs) stdenv;
src = ./.;
installPhase = ''
mkdir -p $out/
cp -R . $out/
propagatedBuildInputs = [ pkgs.python3.pkgs.django_2_2 pkgs.python3.pkgs.pillow ];
postFixup = ''
wrapPythonProgramsIn $out/bin/manage.py
#HACK wrapper breaks django manage.py
sed -i "$out/bin/.manage.py-wrapped" -e '
0,/sys.argv\[0\].*;/s/sys.argv\[0\][^;]*;//
'
'';
doCheck = false;
meta = {
description = "Site de présentation de l'association Musique Fraternité de Meyenheim";
homepage = https://musique-meyenheim.fr;

View File

@ -69,29 +69,5 @@
</a>
</section> <!-- Carousel -->
<section id="contact">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 text-center">
<h2 class="section-heading">Contact</h2>
<hr class="primary">
<p>Céline TREHIOU</p>
</div>
<div class="col-lg-4 col-lg-offset-2 text-center">
<i class="fa fa-phone fa-3x sr-contact"></i>
<p>07 68 40 11 38</p>
</div>
<div class="col-lg-4 text-center">
<i class="fa fa-at fa-3x sr-contact"></i>
<p><a href="mailto:salle@musique-meyenheim.fr">salle@musique-meyenheim.fr</a></p>
</div>
<div class="col-lg-8 col-lg-offset-2 text-center">
<i class="fa fa-envelope fa-3x sr-contact"></i>
<p>Mme TREHIOU Céline</br>4 rue St Michel</br>68890 MEYENHEIM</p>
</div>
</div>
</div>
</section>
{% include "contact.html" with responsable="Céline TREHIOU" email="salle@musique-meyenheim.fr" adresse="Mme TREHIOU Céline</br>4 rue St Michel</br>68890 MEYENHEIM" %}
{% endblock %}

View File

@ -1,4 +1,4 @@
<footer>
<small>Créé par Paul TREHIOU et inspiré du theme <a href="https://startbootstrap.com/template-overviews/creative/">Creative</a> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png"></a> powered by <a href="https://nixos.org/">NixOS</a> and <a href="https://djangoproject.com">Django</a></small>
<a href="{% url 'admin:index' %}">Admin</a>
<footer class="row row-no-gutters">
<small class="col-md-6">Créé par Paul TREHIOU et inspiré du theme <a href="https://startbootstrap.com/template-overviews/creative/">Creative</a> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png"></a> powered by <a href="https://nixos.org/">NixOS</a> and <a href="https://djangoproject.com">Django</a></small>
<a class="col-md-6" href="{% url 'admin:index' %}">Admin</a>
</footer>

View File

@ -3,7 +3,7 @@
<script src="{% static "vendor/jquery.min.js" %}"></script>
<!-- Bootstrap Core JavaScript -->
<script src="{% static "vendor/bootstrap.min.js" %}"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<!-- Plugin JavaScript -->
<script src="{% static "vendor/jquery.easing.min.js" %}"></script>

View File

@ -1,6 +1,6 @@
{% load static %}
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Custom Fonts -->
<script src="https://use.fontawesome.com/49602068ad.js"></script>

View File

@ -1,7 +1,13 @@
from django.contrib import admin
from .models import Timeline
from .models import Evenement, Illustration
@admin.register(Timeline)
class TimelineAdmin(admin.ModelAdmin):
class IllustrationInline(admin.TabularInline):
model = Illustration
@admin.register(Evenement)
class EvenementAdmin(admin.ModelAdmin):
ordering=["-date"]
inlines = [
IllustrationInline,
]

View File

@ -0,0 +1,39 @@
# Generated by Django 2.2.4 on 2019-09-08 13:50
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('timeline', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Evenement',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('titre', models.CharField(max_length=200)),
('date', models.DateField(default=datetime.date.today)),
('heure_debut', models.TimeField(blank=True, null=True)),
('heure_fin', models.TimeField(blank=True, null=True)),
('lieu', models.CharField(blank=True, max_length=200)),
('description', models.TextField(blank=True)),
],
),
migrations.CreateModel(
name='Illustration',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nom', models.CharField(max_length=200)),
('image', models.ImageField(upload_to='timeline')),
('evenement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='timeline.Evenement')),
],
),
migrations.DeleteModel(
name='Timeline',
),
]

View File

@ -1,13 +1,12 @@
from django.db import models
from datetime import date
class Timeline(models.Model):
class Evenement(models.Model):
titre = models.CharField(max_length=200)
date = models.DateField(default=date.today)
heure_debut = models.TimeField(null=True, blank=True)
heure_fin = models.TimeField(null=True, blank=True)
lieu = models.CharField(max_length=200, blank=True)
illustration = models.ImageField(upload_to='timeline')
description = models.TextField(blank=True)
@property
@ -20,3 +19,12 @@ class Timeline(models.Model):
def __str__(self):
return f"[{self.date}] {self.titre}"
class Illustration(models.Model):
nom = models.CharField(max_length=200)
image = models.ImageField(upload_to='timeline')
evenement = models.ForeignKey(Evenement, on_delete=models.CASCADE)
def __str__(self):
return f"[{self.evenement}] {self.nom}"

View File

@ -82,23 +82,64 @@
<small class="text-muted"><i class="glyphicon glyphicon-map-marker"></i>{{ evenement.lieu }}</small></p>
</div>
<div class="timeline-body">
<a href="#pop_timeline_{{ forloop.counter }}" data-toggle="modal">
<img src="{{ evenement.illustration.url }}" class="img-responsive">
{% if evenement.illustration_set.count > 1 %}
<div id="carousel-{{ forloop.counter }}" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
{% for illustration in evenement.illustration_set.all %}
<div class="item{% if forloop.first %} active{% endif %}">
<a href="#pop_timeline_{{ forloop.parentloop.counter }}_{{ forloop.counter }}" data-toggle="modal">
<img src="{{ illustration.image.url }}" class="img-responsive">
</a>
</div>
{% endfor %}
</div>
<a class="left carousel-control" href="#carousel-{{ forloop.counter }}" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-{{ forloop.counter }}" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<hr>
<p>{{ evenement.description }}</p>
{% for illustration in evenement.illustration_set.all %}
<div id="pop_timeline_{{ forloop.parentloop.counter }}_{{ forloop.counter }}" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img src="{{ illustration.image.url }}" class="img-responsive">
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
{% with evenement.illustration_set.all|first as illustration %}
<a href="#pop_timeline_{{ forloop.counter }}" data-toggle="modal">
<img src="{{ illustration.image.url }}" class="img-responsive">
</a>
<hr>
<p>{{ evenement.description }}</p>
<!-- Popup -->
<div id="pop_timeline_{{ forloop.counter }}" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img src="{{ evenement.illustration.url }}" class="img-responsive">
<img src="{{ illustration.image.url }}" class="img-responsive">
</div>
</div>
</div>
</div>
{% endwith %}
{% endif %}
</div>
</div>
</li>

View File

@ -1,9 +1,9 @@
from django.shortcuts import render
from .models import Timeline
from .models import Evenement
def index(request):
liste_evenements = Timeline.objects.order_by('-date')
liste_evenements = Evenement.objects.order_by('-date')
context = {
'liste_evenements': liste_evenements,
}