forked from DGNum/gestioCOF
Ajout d'infos dans les spectacles
- Ajoute des informations supplémentaires au modèle `Spectacle`. - Supprime le champ inutilisé `priority`. - Utilise le champ inutilisé `slots_description`. - Adapte le template `descriptions.html` et la vue admin à ces changements.
This commit is contained in:
parent
87149d0d4e
commit
ab4e7ec084
5 changed files with 152 additions and 20 deletions
10
bda/admin.py
10
bda/admin.py
|
@ -9,7 +9,7 @@ from django.core.mail import send_mail
|
|||
from django.contrib import admin
|
||||
from django.db.models import Sum, Count
|
||||
from bda.models import Spectacle, Salle, Participant, ChoixSpectacle,\
|
||||
Attribution, Tirage
|
||||
Attribution, Tirage, Quote, CategorieSpectacle
|
||||
from django import forms
|
||||
|
||||
from datetime import timedelta
|
||||
|
@ -182,7 +182,12 @@ class ChoixSpectacleAdmin(admin.ModelAdmin):
|
|||
'spectacle__title')
|
||||
|
||||
|
||||
class QuoteInline(admin.TabularInline):
|
||||
model = Quote
|
||||
|
||||
|
||||
class SpectacleAdmin(admin.ModelAdmin):
|
||||
inlines = [QuoteInline]
|
||||
model = Spectacle
|
||||
list_display = ("title", "date", "tirage", "location", "slots", "price",
|
||||
"listing")
|
||||
|
@ -194,7 +199,7 @@ class SpectacleAdmin(admin.ModelAdmin):
|
|||
class TirageAdmin(admin.ModelAdmin):
|
||||
model = Tirage
|
||||
list_display = ("title", "ouverture", "fermeture", "active",
|
||||
"enable_do_tirage")
|
||||
"enable_do_tirage")
|
||||
readonly_fields = ("tokens", )
|
||||
list_filter = ("active", )
|
||||
search_fields = ("title", )
|
||||
|
@ -205,6 +210,7 @@ class SalleAdmin(admin.ModelAdmin):
|
|||
search_fields = ('name', 'address')
|
||||
|
||||
|
||||
admin.site.register(CategorieSpectacle)
|
||||
admin.site.register(Spectacle, SpectacleAdmin)
|
||||
admin.site.register(Salle, SalleAdmin)
|
||||
admin.site.register(Participant, ParticipantAdmin)
|
||||
|
|
|
@ -74,7 +74,6 @@
|
|||
"description": "Jazz / Funk",
|
||||
"title": "Un super concert",
|
||||
"price": 10.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 2,
|
||||
"date": "2016-09-30T18:00:00Z",
|
||||
|
@ -91,7 +90,6 @@
|
|||
"description": "Homemade",
|
||||
"title": "Une super pi\u00e8ce",
|
||||
"price": 10.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 3,
|
||||
"date": "2016-09-29T14:00:00Z",
|
||||
|
@ -108,7 +106,6 @@
|
|||
"description": "Plein air, soleil, bonne musique",
|
||||
"title": "Concert pour la f\u00eate de la musique",
|
||||
"price": 5.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 1,
|
||||
"date": "2016-09-21T15:00:00Z",
|
||||
|
@ -125,7 +122,6 @@
|
|||
"description": "Sous le regard s\u00e9v\u00e8re de Louis Pasteur",
|
||||
"title": "Op\u00e9ra sans d\u00e9cors",
|
||||
"price": 5.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 4,
|
||||
"date": "2016-10-06T19:00:00Z",
|
||||
|
@ -142,7 +138,6 @@
|
|||
"description": "Buffet \u00e0 la fin",
|
||||
"title": "Concert Trouv\u00e8re",
|
||||
"price": 20.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 5,
|
||||
"date": "2016-11-30T12:00:00Z",
|
||||
|
@ -159,7 +154,6 @@
|
|||
"description": "Vive les maths",
|
||||
"title": "Dessin \u00e0 la craie sur tableau noir",
|
||||
"price": 10.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 6,
|
||||
"date": "2016-12-15T07:00:00Z",
|
||||
|
@ -176,7 +170,6 @@
|
|||
"description": "Une pi\u00e8ce \u00e0 un personnage",
|
||||
"title": "D\u00e9cors, d\u00e9montage en musique",
|
||||
"price": 0.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 3,
|
||||
"date": "2016-12-26T07:00:00Z",
|
||||
|
@ -193,7 +186,6 @@
|
|||
"description": "Annulera, annulera pas\u00a0?",
|
||||
"title": "La Nuit",
|
||||
"price": 27.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 1,
|
||||
"date": "2016-11-14T23:00:00Z",
|
||||
|
@ -210,7 +202,6 @@
|
|||
"description": "Le boum fait sa carte blanche",
|
||||
"title": "Turbomix",
|
||||
"price": 10.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 2,
|
||||
"date": "2017-01-10T20:00:00Z",
|
||||
|
@ -227,7 +218,6 @@
|
|||
"description": "Unique repr\u00e9sentation",
|
||||
"title": "Carinettes et trombone",
|
||||
"price": 15.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 5,
|
||||
"date": "2017-01-02T14:00:00Z",
|
||||
|
@ -244,7 +234,6 @@
|
|||
"description": "Suivi d'une jam session",
|
||||
"title": "Percussion sur rondins",
|
||||
"price": 5.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 4,
|
||||
"date": "2017-01-13T14:00:00Z",
|
||||
|
@ -261,7 +250,6 @@
|
|||
"description": "\u00c9preuve sportive et artistique",
|
||||
"title": "Bassin aux ernests, nage libre",
|
||||
"price": 5.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 1,
|
||||
"date": "2016-11-17T09:00:00Z",
|
||||
|
@ -278,7 +266,6 @@
|
|||
"description": "Sonore",
|
||||
"title": "Chant du barde",
|
||||
"price": 13.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 2,
|
||||
"date": "2017-02-26T07:00:00Z",
|
||||
|
@ -295,7 +282,6 @@
|
|||
"description": "Cocorico",
|
||||
"title": "Chant du coq",
|
||||
"price": 4.0,
|
||||
"priority": 1000,
|
||||
"rappel_sent": null,
|
||||
"location": 1,
|
||||
"date": "2016-12-17T04:00:00Z",
|
||||
|
|
86
bda/migrations/0007_extends_spectacle.py
Normal file
86
bda/migrations/0007_extends_spectacle.py
Normal file
|
@ -0,0 +1,86 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bda', '0006_add_tirage_switch'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CategorieSpectacle',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False,
|
||||
auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=300, verbose_name='Nom')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Cat\xe9gorie',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Quote',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('text', models.TextField(verbose_name='Citation')),
|
||||
('author', models.CharField(max_length=200, verbose_name='Auteur')),
|
||||
],
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='spectacle',
|
||||
options={'ordering': ('date', 'title'),
|
||||
'verbose_name': 'Spectacle'},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='spectacle',
|
||||
name='priority',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='spectacle',
|
||||
name='ext_link',
|
||||
field=models.CharField(
|
||||
max_length=500,
|
||||
verbose_name='Lien vers le site du spectacle',
|
||||
blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='spectacle',
|
||||
name='image',
|
||||
field=models.ImageField(upload_to='imgs/shows/', null=True,
|
||||
verbose_name='Image', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tirage',
|
||||
name='enable_do_tirage',
|
||||
field=models.BooleanField(
|
||||
default=False,
|
||||
verbose_name='Le tirage peut \xeatre lanc\xe9'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tirage',
|
||||
name='tokens',
|
||||
field=models.TextField(verbose_name='Graine(s) du tirage',
|
||||
blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='spectacle',
|
||||
name='category',
|
||||
field=models.ForeignKey(blank=True, to='bda.CategorieSpectacle',
|
||||
null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='spectacle',
|
||||
name='vips',
|
||||
field=models.TextField(verbose_name='Personnalit\xe9s',
|
||||
blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='quote',
|
||||
name='spectacle',
|
||||
field=models.ForeignKey(to='bda.Spectacle'),
|
||||
),
|
||||
]
|
|
@ -29,7 +29,7 @@ class Tirage(models.Model):
|
|||
tokens = models.TextField("Graine(s) du tirage", blank=True)
|
||||
active = models.BooleanField("Tirage actif", default=False)
|
||||
enable_do_tirage = models.BooleanField("Le tirage peut être lancé",
|
||||
default=False)
|
||||
default=False)
|
||||
|
||||
def date_no_seconds(self):
|
||||
return self.fermeture.strftime('%d %b %Y %H:%M')
|
||||
|
@ -47,16 +47,32 @@ class Salle(models.Model):
|
|||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CategorieSpectacle(models.Model):
|
||||
name = models.CharField('Nom', max_length=300)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Catégorie"
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Spectacle(models.Model):
|
||||
title = models.CharField("Titre", max_length=300)
|
||||
category = models.ForeignKey(CategorieSpectacle, blank=True, null=True)
|
||||
date = models.DateTimeField("Date & heure")
|
||||
location = models.ForeignKey(Salle)
|
||||
vips = models.TextField('Personnalités', blank=True)
|
||||
description = models.TextField("Description", blank=True)
|
||||
slots_description = models.TextField("Description des places", blank=True)
|
||||
image = models.ImageField('Image', blank=True, null=True,
|
||||
upload_to='imgs/shows/')
|
||||
ext_link = models.CharField('Lien vers le site du spectacle', blank=True,
|
||||
max_length=500)
|
||||
price = models.FloatField("Prix d'une place")
|
||||
slots = models.IntegerField("Places")
|
||||
priority = models.IntegerField("Priorité", default=1000)
|
||||
tirage = models.ForeignKey(Tirage)
|
||||
listing = models.BooleanField("Les places sont sur listing")
|
||||
rappel_sent = models.DateTimeField("Mail de rappel envoyé", blank=True,
|
||||
|
@ -64,7 +80,7 @@ class Spectacle(models.Model):
|
|||
|
||||
class Meta:
|
||||
verbose_name = "Spectacle"
|
||||
ordering = ("priority", "date", "title",)
|
||||
ordering = ("date", "title",)
|
||||
|
||||
def __repr__(self):
|
||||
return "[%s]" % self
|
||||
|
@ -111,6 +127,13 @@ class Spectacle(models.Model):
|
|||
# On renvoie la liste des destinataires
|
||||
return members.values()
|
||||
|
||||
|
||||
class Quote(models.Model):
|
||||
spectacle = models.ForeignKey(Spectacle)
|
||||
text = models.TextField('Citation')
|
||||
author = models.CharField('Auteur', max_length=200)
|
||||
|
||||
|
||||
PAYMENT_TYPES = (
|
||||
("cash", "Cash"),
|
||||
("cb", "CB"),
|
||||
|
|
|
@ -10,15 +10,25 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>{{ show.location }}</td>
|
||||
<td></td>
|
||||
<td>{% if show.category %}{{ show.category }}{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ show.date }}</td>
|
||||
<td>{{ show.slots }} place{{ show.slots|pluralize}} - show.price</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p style="text-align: justify;">{{ show.vips }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p style="text-align: justify;">{{ show.description }}</p>
|
||||
{% for quote in show.quote_set.all %}
|
||||
<br />
|
||||
<p style="text-align: center;">“{{ quote.text }}”</p>
|
||||
<div align="right">{{ quote.author }}</div>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if slots_description != "" %}
|
||||
|
@ -28,6 +38,27 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if show.image %}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p style="text-align: center;">
|
||||
{% if show.ext_link != "" %}
|
||||
<a href="{{ show.ext_link }}"
|
||||
<img style="display: inline;" src="{{ show.image }}" alt="{{ show.title }}" />
|
||||
</a>
|
||||
{% else %}
|
||||
<img style="display: inline;" src="{{ show.image }}" alt="{{ show.title }}" />
|
||||
{% endif %}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
{% elif show.ext_link != "" %}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<a href="{{ show.ext_link }}">Lien vers le site du spectacle</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue