chore(cof): production follow master #858
10 changed files with 60 additions and 2 deletions
1
.credentials/SYMPA_PASSWORD
Normal file
1
.credentials/SYMPA_PASSWORD
Normal file
|
@ -0,0 +1 @@
|
||||||
|
toto
|
1
.credentials/SYMPA_USERNAME
Normal file
1
.credentials/SYMPA_USERNAME
Normal file
|
@ -0,0 +1 @@
|
||||||
|
sympa
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,3 +21,4 @@ media/
|
||||||
# VSCode
|
# VSCode
|
||||||
.vscode/
|
.vscode/
|
||||||
.direnv
|
.direnv
|
||||||
|
.static
|
||||||
|
|
18
bda/migrations/0019_auto_20240707_1359.py
Normal file
18
bda/migrations/0019_auto_20240707_1359.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2.28 on 2024-07-07 11:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('bda', '0018_auto_20201021_1818'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='attribution',
|
||||||
|
name='paymenttype',
|
||||||
|
field=models.CharField(blank=True, choices=[('cash', 'Cash'), ('cb', 'CB'), ('cheque', 'Chèque'), ('virement', 'Virement'), ('autre', 'Autre')], max_length=8, verbose_name='Moyen de paiement'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Generated by Django 4.2.16 on 2025-02-26 08:23
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("bda", "0019_auto_20220630_1245"),
|
||||||
|
("bda", "0019_auto_20240707_1359"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
|
@ -151,6 +151,7 @@ PAYMENT_TYPES = (
|
||||||
("cash", "Cash"),
|
("cash", "Cash"),
|
||||||
("cb", "CB"),
|
("cb", "CB"),
|
||||||
("cheque", "Chèque"),
|
("cheque", "Chèque"),
|
||||||
|
("virement", "Virement"),
|
||||||
("autre", "Autre"),
|
("autre", "Autre"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -163,7 +164,7 @@ class Attribution(models.Model):
|
||||||
given = models.BooleanField("Donnée", default=False)
|
given = models.BooleanField("Donnée", default=False)
|
||||||
paid = models.BooleanField("Payée", default=False)
|
paid = models.BooleanField("Payée", default=False)
|
||||||
paymenttype = models.CharField(
|
paymenttype = models.CharField(
|
||||||
"Moyen de paiement", max_length=6, choices=PAYMENT_TYPES, blank=True
|
"Moyen de paiement", max_length=8, choices=PAYMENT_TYPES, blank=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -11,9 +11,19 @@
|
||||||
<td>{{place.spectacle.date}}</td>
|
<td>{{place.spectacle.date}}</td>
|
||||||
<td>{% if place.double %}deux places{%else%}une place{% endif %}</td>
|
<td>{% if place.double %}deux places{%else%}une place{% endif %}</td>
|
||||||
<td>{% if place.spectacle.listing %}sur listing{% else %}place physique{% endif %}</td>
|
<td>{% if place.spectacle.listing %}sur listing{% else %}place physique{% endif %}</td>
|
||||||
|
<td>
|
||||||
|
{% if place.unpaid == 0 %}
|
||||||
|
Payé
|
||||||
|
{% elif place.unpaid == 1 %}
|
||||||
|
Une place à payer ({{place.unpaid_price|floatformat}}€)
|
||||||
|
{% else %}
|
||||||
|
Deux places à payer ({{place.unpaid_price|floatformat}}€)
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
<h4 class="bda-prix">Reste à payer : {{ unpaid|floatformat }}€</h4>
|
||||||
<h4 class="bda-prix">Total à payer : {{ total|floatformat }}€</h4>
|
<h4 class="bda-prix">Total à payer : {{ total|floatformat }}€</h4>
|
||||||
<br/>
|
<br/>
|
||||||
<p>Ne manque pas un spectacle avec le
|
<p>Ne manque pas un spectacle avec le
|
||||||
|
|
10
bda/views.py
10
bda/views.py
|
@ -114,6 +114,7 @@ def places(request, tirage_id):
|
||||||
"spectacle__date", "spectacle"
|
"spectacle__date", "spectacle"
|
||||||
).select_related("spectacle", "spectacle__location")
|
).select_related("spectacle", "spectacle__location")
|
||||||
total = sum(place.spectacle.price for place in places)
|
total = sum(place.spectacle.price for place in places)
|
||||||
|
unpaid = 0
|
||||||
filtered_places = []
|
filtered_places = []
|
||||||
places_dict = {}
|
places_dict = {}
|
||||||
spectacles = []
|
spectacles = []
|
||||||
|
@ -124,6 +125,8 @@ def places(request, tirage_id):
|
||||||
places_dict[place.spectacle].double = True
|
places_dict[place.spectacle].double = True
|
||||||
else:
|
else:
|
||||||
place.double = False
|
place.double = False
|
||||||
|
place.unpaid = 0
|
||||||
|
place.unpaid_price = 0
|
||||||
places_dict[place.spectacle] = place
|
places_dict[place.spectacle] = place
|
||||||
spectacles.append(place.spectacle)
|
spectacles.append(place.spectacle)
|
||||||
filtered_places.append(place)
|
filtered_places.append(place)
|
||||||
|
@ -132,6 +135,12 @@ def places(request, tirage_id):
|
||||||
warning = True
|
warning = True
|
||||||
else:
|
else:
|
||||||
dates.append(date)
|
dates.append(date)
|
||||||
|
|
||||||
|
if not place.paid:
|
||||||
|
unpaid += place.spectacle.price
|
||||||
|
places_dict[place.spectacle].unpaid += 1
|
||||||
|
places_dict[place.spectacle].unpaid_price += place.spectacle.price
|
||||||
|
|
||||||
# On prévient l'utilisateur s'il a deux places à la même date
|
# On prévient l'utilisateur s'il a deux places à la même date
|
||||||
if warning:
|
if warning:
|
||||||
messages.warning(
|
messages.warning(
|
||||||
|
@ -147,6 +156,7 @@ def places(request, tirage_id):
|
||||||
"places": filtered_places,
|
"places": filtered_places,
|
||||||
"tirage": tirage,
|
"tirage": tirage,
|
||||||
"total": total,
|
"total": total,
|
||||||
|
"unpaid": unpaid,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ if settings.DEBUG:
|
||||||
# Si on est en production, MEDIA_ROOT est servi par Apache.
|
# Si on est en production, MEDIA_ROOT est servi par Apache.
|
||||||
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
|
||||||
|
|
||||||
# Wagtail URLs (wagtail urls must be last, as catch-all)
|
# Wagtail URLs (wagtail urls must be last, as catch-all)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
sources ? import ./npins,
|
sources ? import ./npins,
|
||||||
pkgs ? import sources.nixpkgs { },
|
pkgs ? import sources.nixpkgs { overlays = [ ]; },
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -72,6 +72,8 @@ pkgs.mkShell {
|
||||||
black
|
black
|
||||||
flake8
|
flake8
|
||||||
isort
|
isort
|
||||||
|
|
||||||
|
daphne
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
pkgs.npins
|
pkgs.npins
|
||||||
|
|
Loading…
Add table
Reference in a new issue