0001-manager-grab-error-message-from-context-40051.patch
chrono/manager/templates/chrono/manager_confirm_delete.html | ||
---|---|---|
10 | 10 |
{% csrf_token %} |
11 | 11 |
<p> |
12 | 12 |
{% if cannot_delete %} |
13 |
{% blocktrans %}This cannot be removed as there are bookings for a future date. |
|
14 |
{% endblocktrans %} |
|
13 |
{{ cannot_delete_msg }} |
|
15 | 14 |
{% else %} |
16 | 15 |
{% blocktrans %}Are you sure you want to delete this?{% endblocktrans %} |
17 | 16 |
{% endif %} |
chrono/manager/views.py | ||
---|---|---|
75 | 75 |
from .utils import import_site |
76 | 76 | |
77 | 77 | |
78 |
FUTURE_BOOKING_ERROR_MSG = _('This cannot be removed as there are bookings for a future date.') |
|
79 | ||
80 | ||
78 | 81 |
class HomepageView(ListView): |
79 | 82 |
template_name = 'chrono/manager_home.html' |
80 | 83 |
model = Agenda |
... | ... | |
221 | 224 |
event__start_datetime__gt=now(), |
222 | 225 |
cancellation_datetime__isnull=True, |
223 | 226 |
).exists() |
227 |
context['cannot_delete_msg'] = FUTURE_BOOKING_ERROR_MSG |
|
224 | 228 |
return context |
225 | 229 | |
226 | 230 |
def delete(self, request, *args, **kwargs): |
... | ... | |
857 | 861 |
context['cannot_delete'] = Booking.objects.filter( |
858 | 862 |
event__desk=self.get_object(), event__start_datetime__gt=now(), cancellation_datetime__isnull=True |
859 | 863 |
).exists() |
864 |
context['cannot_delete_msg'] = FUTURE_BOOKING_ERROR_MSG |
|
860 | 865 |
return context |
861 | 866 | |
862 | 867 |
def delete(self, request, *args, **kwargs): |
863 |
- |