0001-agendas-add-str-method-to-Booking-45742.patch
chrono/agendas/models.py | ||
---|---|---|
41 | 41 |
from django.utils.formats import date_format |
42 | 42 |
from django.utils.text import slugify |
43 | 43 |
from django.utils.timezone import localtime, now, make_aware, make_naive, is_aware |
44 |
from django.utils.translation import ugettext_lazy as _ |
|
44 |
from django.utils.translation import ugettext_lazy as _, ugettext
|
|
45 | 45 | |
46 | 46 |
from jsonfield import JSONField |
47 | 47 | |
... | ... | |
1015 | 1015 |
new_booking.save() |
1016 | 1016 |
return new_booking |
1017 | 1017 | |
1018 |
def events_display(self): |
|
1019 |
name = self.user_name or _('Unknown') |
|
1020 |
return '%s, %s' % (name, date_format(localtime(self.creation_datetime), 'DATETIME_FORMAT')) |
|
1021 | ||
1022 |
def meetings_display(self): |
|
1023 |
if self.label and self.user_name: |
|
1024 |
return '%s - %s' % (self.label, self.user_name) |
|
1025 |
elif self.label or self.user_name: |
|
1026 |
return self.label or self.user_name |
|
1027 |
else: |
|
1028 |
return ugettext('booked') |
|
1029 | ||
1018 | 1030 | |
1019 | 1031 |
OpeningHour = collections.namedtuple('OpeningHour', ['begin', 'end']) |
1020 | 1032 |
chrono/manager/templates/chrono/manager_agenda_day_view.html | ||
---|---|---|
71 | 71 |
<div class="booking" |
72 | 72 |
style="height: {{ booking.css_height }}%; min-height: {{ booking.css_height }}%; top: {{ booking.css_top }}%;" |
73 | 73 |
><span class="start-time">{{booking.event.start_datetime|date:"TIME_FORMAT"}}</span> |
74 |
<a {% if booking.backoffice_url %}href="{{booking.backoffice_url}}"{% endif %} |
|
75 |
>{% if booking.label or booking.user_name %} |
|
76 |
{{booking.label}}{% if booking.label and booking.user_name %} - {% endif %} {{booking.user_name}} |
|
77 |
{% else %}{% trans "booked" %}{% endif %}</a> |
|
74 |
<a {% if booking.backoffice_url %}href="{{booking.backoffice_url}}"{% endif %}>{{ booking.meetings_display }}</a> |
|
78 | 75 |
<a rel="popup" class="cancel" href="{% url 'chrono-manager-booking-cancel' pk=agenda.id booking_pk=booking.id %}?next={{ request.path }}">{% trans "Cancel" %}</a> |
79 | 76 |
</div> |
80 | 77 |
{% endfor %} |
chrono/manager/templates/chrono/manager_event_detail_fragment.html | ||
---|---|---|
28 | 28 | |
29 | 29 |
<ul class="objects-list single-links"> |
30 | 30 |
{% for booking in booked %} |
31 |
<li><a {% if booking.backoffice_url %}href="{{ booking.backoffice_url }}"{% endif %}>{% if booking.user_name %}{{ booking.user_name }}{% else %}{% trans "Unknown" %}{% endif %}, |
|
32 |
{{ booking.creation_datetime|date:"DATETIME_FORMAT" }}</a> |
|
31 |
<li><a {% if booking.backoffice_url %}href="{{ booking.backoffice_url }}"{% endif %}>{{ booking }}</a> |
|
33 | 32 |
<a rel="popup" class="delete" href="{% url 'chrono-manager-booking-cancel' pk=agenda.id booking_pk=booking.id %}?next={{ request.path }}">{% trans "Cancel" %}</a> |
34 | 33 |
</li> |
35 | 34 |
{% endfor %} |
... | ... | |
49 | 48 |
<div> |
50 | 49 |
<ul class="objects-list single-links"> |
51 | 50 |
{% for booking in waiting %} |
52 |
<li><a {% if booking.backoffice_url %}href="{{ booking.backoffice_url }}"{% endif %}>{% if booking.user_name %}{{ booking.user_name }}{% else %}{% trans "Unknown" %}{% endif %}, |
|
53 |
{{ booking.creation_datetime|date:"DATETIME_FORMAT" }}</a></li> |
|
51 |
<li><a {% if booking.backoffice_url %}href="{{ booking.backoffice_url }}"{% endif %}>{{ booking.events_display }}</a></li> |
|
54 | 52 |
{% endfor %} |
55 | 53 |
</ul> |
56 | 54 |
</div> |
chrono/manager/templates/chrono/manager_meetings_agenda_month_view.html | ||
---|---|---|
35 | 35 |
{% for slot in day.infos.booked_slots %} |
36 | 36 |
<div class="booking" style="left:{{ slot.css_left|stringformat:".1f" }}%;height:{{ slot.css_height|stringformat:".1f" }}%;min-height:{{ slot.css_height|stringformat:".1f" }}%;top:{{ slot.css_top|stringformat:".1f" }}%;width:{{ slot.css_width|stringformat:".1f" }}%"> |
37 | 37 |
<span class="start-time">{{slot.booking.event.start_datetime|date:"TIME_FORMAT"}}</span> |
38 |
<a {% if slot.booking.backoffice_url %}href="{{slot.booking.backoffice_url}}"{% endif %} |
|
39 |
>{% if slot.booking.label or slot.booking.user_name %} |
|
40 |
{{slot.booking.label}}{% if slot.booking.label and slot.booking.user_name %} - {% endif %} {{slot.booking.user_name}} |
|
41 |
{% else %}{% trans "booked" %}{% endif %}</a> |
|
38 |
<a {% if slot.booking.backoffice_url %}href="{{slot.booking.backoffice_url}}"{% endif %}>{{ booking.meetings_display }}</a> |
|
42 | 39 |
<a rel="popup" class="cancel" href="{% url 'chrono-manager-booking-cancel' pk=agenda.id booking_pk=slot.booking.id %}?next={{ request.path }}">{% trans "Cancel" %}</a> |
43 | 40 |
{% if not single_desk %}<span class="desk">{{ slot.desk }}</span>{% endif %} |
44 | 41 |
</div> |
chrono/manager/templates/chrono/manager_resource_day_view.html | ||
---|---|---|
40 | 40 |
<div class="booking" |
41 | 41 |
style="height: {{ booking.css_height }}%; min-height: {{ booking.css_height }}%; top: {{ booking.css_top }}%;" |
42 | 42 |
><span class="start-time">{{ booking.event.start_datetime|date:"TIME_FORMAT" }}</span> |
43 |
<a {% if booking.backoffice_url %}href="{{ booking.backoffice_url }}"{% endif %} |
|
44 |
>{% if booking.label or booking.user_name %} |
|
45 |
{{ booking.label }}{% if booking.label and booking.user_name %} - {% endif %} {{ booking.user_name }} |
|
46 |
{% else %}{% trans "booked" %}{% endif %}</a> |
|
43 |
<a {% if booking.backoffice_url %}href="{{ booking.backoffice_url }}"{% endif %}>{{ booking.meetings_display }}</a> |
|
47 | 44 |
</div> |
48 | 45 |
{% endfor %} |
49 | 46 |
</td> |
chrono/manager/templates/chrono/manager_resource_month_view.html | ||
---|---|---|
49 | 49 |
{% for slot in day.infos.booked_slots %} |
50 | 50 |
<div class="booking" style="height:{{ slot.css_height|stringformat:".1f" }}%;min-height:{{ slot.css_height|stringformat:".1f" }}%;top:{{ slot.css_top|stringformat:".1f" }}%"> |
51 | 51 |
<span class="start-time">{{ slot.booking.event.start_datetime|date:"TIME_FORMAT" }}</span> |
52 |
<a {% if slot.booking.backoffice_url %}href="{{ slot.booking.backoffice_url }}"{% endif %} |
|
53 |
>{% if slot.booking.label or slot.booking.user_name %} |
|
54 |
{{ slot.booking.label }}{% if slot.booking.label and slot.booking.user_name %} - {% endif %} {{ slot.booking.user_name }} |
|
55 |
{% else %}{% trans "booked" %}{% endif %}</a> |
|
52 |
<a {% if slot.booking.backoffice_url %}href="{{ slot.booking.backoffice_url }}"{% endif %}>{{ booking.meetings_display }}</a> |
|
56 | 53 |
</div> |
57 | 54 |
{% endfor %} |
58 | 55 |
{% endif %} |
59 |
- |