diff --git a/bda/admin.py b/bda/admin.py
index c706c0dd..55030b53 100644
--- a/bda/admin.py
+++ b/bda/admin.py
@@ -219,10 +219,10 @@ class SpectacleReventeAdmin(admin.ModelAdmin):
list_display = ("spectacle", "seller", "date", "soldTo")
raw_id_fields = ("attribution",)
readonly_fields = ("expiration_time",)
- search_fields = ("spectacle__title",
- "seller__user__username",
- "seller__user__firstname",
- "seller__user__lastname",)
+ search_fields = ['attribution__spectacle__title',
+ 'seller__user__username',
+ 'seller__user__first_name',
+ 'seller__user__last_name']
admin.site.register(CategorieSpectacle)
diff --git a/bda/models.py b/bda/models.py
index a9fd702f..a09652fd 100644
--- a/bda/models.py
+++ b/bda/models.py
@@ -254,7 +254,7 @@ class SpectacleRevente(models.Model):
def expiration_time_str(self):
return self.expiration_time \
.astimezone(timezone.get_current_timezone()) \
- .strftime('%D à %H:%M')
+ .strftime('%d/%m/%y à %H:%M')
def __str__(self):
return "%s -- %s" % (self.seller,
diff --git a/bda/templates/bda-shotgun.html b/bda/templates/bda-shotgun.html
new file mode 100644
index 00000000..e10fae00
--- /dev/null
+++ b/bda/templates/bda-shotgun.html
@@ -0,0 +1,14 @@
+{% extends "base_title.html" %}
+
+{% block realcontent %}
+
Places disponibles immédiatement
+ {% if shotgun %}
+
+ {% for spectacle in shotgun %}
+ - {{spectacle}}
+ {% endfor %}
+ {% else %}
+ Pas de places disponibles immédiatement, désolé !
+ {% endif %}
+
+{% endblock %}
diff --git a/bda/templates/liste-reventes.html b/bda/templates/liste-reventes.html
index 78f3ac08..d08d4010 100644
--- a/bda/templates/liste-reventes.html
+++ b/bda/templates/liste-reventes.html
@@ -11,16 +11,29 @@
{% endif %}
- {% if shotgun %}
-
- Places disponibles immédiatement
-
- {% for spectacle in shotgun %}
- - {{spectacle}}
- {% endfor %}
- {% endif %}
+
{% endblock %}
diff --git a/bda/urls.py b/bda/urls.py
index 94b797fa..bbbf8e39 100644
--- a/bda/urls.py
+++ b/bda/urls.py
@@ -33,14 +33,17 @@ urlpatterns = [
views.unpaid,
name="bda-unpaid"),
url(r'^liste-revente/(?P\d+)$',
- "bda.views.list_revente",
+ views.list_revente,
name="bda-liste-revente"),
url(r'^buy-revente/(?P\d+)$',
- "bda.views.buy_revente",
+ views.buy_revente,
name="bda-buy-revente"),
url(r'^revente-interested/(?P\d+)$',
- "bda.views.revente_interested",
+ views.revente_interested,
name='bda-revente-interested'),
+ url(r'^revente-immediat/(?P\d+)$',
+ views.revente_shotgun,
+ name="bda-shotgun"),
url(r'^mails-rappel/(?P\d+)$', views.send_rappel),
url(r'^descriptions/(?P\d+)$', views.descriptions_spectacles,
name='bda-descriptions'),
diff --git a/bda/views.py b/bda/views.py
index 5cbe5b13..3ca8d107 100644
--- a/bda/views.py
+++ b/bda/views.py
@@ -435,7 +435,7 @@ def buy_revente(request, spectacle_id):
if reventes.filter(seller=participant).exists():
revente = reventes.filter(seller=participant)[0]
revente.delete()
- return HttpResponseRedirect(reverse("bda-liste-revente",
+ return HttpResponseRedirect(reverse("bda-shotgun",
args=[tirage.id]))
reventes_shotgun = reventes.filter(shotgun=True)
@@ -467,6 +467,27 @@ Contacte-moi si tu es toujours intéressé·e !
"user": request.user})
+@login_required
+def revente_shotgun(request, tirage_id):
+ tirage = get_object_or_404(Tirage, id=tirage_id)
+ spectacles = tirage.spectacle_set.filter(
+ date__gte=timezone.now())
+ shotgun = []
+ for spectacle in spectacles:
+ revente_objects = SpectacleRevente.objects.filter(
+ attribution__spectacle=spectacle,
+ soldTo__isnull=True)
+ revente_count = 0
+ for revente in revente_objects:
+ if revente.shotgun:
+ revente_count += 1
+ if revente_count:
+ shotgun.append(spectacle)
+
+ return render(request, "bda-shotgun.html",
+ {"shotgun": shotgun})
+
+
@buro_required
def spectacle(request, tirage_id, spectacle_id):
tirage = get_object_or_404(Tirage, id=tirage_id)
diff --git a/gestioncof/templates/home.html b/gestioncof/templates/home.html
index 35a6bc06..c85cbbe1 100644
--- a/gestioncof/templates/home.html
+++ b/gestioncof/templates/home.html
@@ -44,6 +44,7 @@
- Mes places
- Revendre une place
- S'inscrire à BdA-Revente
+ - Places disponibles immédiatement
{% endif %}
{% endfor %}