forked from CGM_Public/pretix_original
Dashboard and product list: Respect availability dates of products
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
<th class="iconcol"></th>
|
||||
<th class="iconcol"></th>
|
||||
<th class="iconcol"></th>
|
||||
<th class="iconcol"></th>
|
||||
<th>{% trans "Category" %}</th>
|
||||
<th class="action-col-2"></th>
|
||||
<th class="action-col-2"></th>
|
||||
@@ -51,6 +52,12 @@
|
||||
{% if not i.active %}</strike>{% endif %}
|
||||
</strong>
|
||||
</td>
|
||||
<td>
|
||||
{% if i.available_from or i.available_until %}
|
||||
<span class="fa fa-clock-o fa-fw text-muted" data-toggle="tooltip" title="{% trans "Only available in a limited timeframe" %}">
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if i.admission %}
|
||||
<span class="fa fa-user fa-fw text-muted" data-toggle="tooltip" title="{% trans "Admission ticket" %}"></span>
|
||||
|
||||
@@ -13,6 +13,7 @@ from django.template.loader import get_template
|
||||
from django.utils import formats
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.html import escape
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
||||
|
||||
from pretix.base.models import (
|
||||
@@ -34,6 +35,9 @@ NUM_WIDGET = '<div class="numwidget"><span class="num">{num}</span><span class="
|
||||
def base_widgets(sender, subevent=None, **kwargs):
|
||||
prodc = Item.objects.filter(
|
||||
event=sender, active=True,
|
||||
).filter(
|
||||
(Q(available_until__isnull=True) | Q(available_until__gte=now())) &
|
||||
(Q(available_from__isnull=True) | Q(available_from__lte=now()))
|
||||
).count()
|
||||
|
||||
if subevent:
|
||||
|
||||
Reference in New Issue
Block a user