feat: Show room functional name when editing timeslots (#7075)
* feat: Show functional name in str(Room) * feat: Show func name in edit_timeslots.html * test: Update test_location_options
This commit is contained in:
parent
52a707628f
commit
5fc0f6926b
|
@ -451,8 +451,9 @@ class Room(models.Model):
|
|||
# end floorplan-related stuff
|
||||
|
||||
def __str__(self):
|
||||
return u"%s size: %s" % (self.name, self.capacity)
|
||||
|
||||
if len(self.functional_name) > 0 and self.functional_name != self.name:
|
||||
return f"{self.name} [{self.functional_name}] (size: {self.capacity})"
|
||||
return f"{self.name} (size: {self.capacity})"
|
||||
|
||||
def dom_id(self):
|
||||
return "room%u" % (self.pk)
|
||||
|
|
|
@ -140,13 +140,13 @@ class TimeSlotEditFormTests(TestCase):
|
|||
rendered = str(TimeSlotEditForm(instance=ts)['location'])
|
||||
# noinspection PyTypeChecker
|
||||
self.assertInHTML(
|
||||
f'<option value="{ts.location.pk}" selected>{ts.location.name} size: None</option>',
|
||||
f'<option value="{ts.location.pk}" selected>{ts.location}</option>',
|
||||
rendered,
|
||||
)
|
||||
for room in rooms:
|
||||
# noinspection PyTypeChecker
|
||||
self.assertInHTML(
|
||||
f'<option value="{room.pk}">{room.name} size: {room.capacity}</option>',
|
||||
f'<option value="{room.pk}">{room}</option>',
|
||||
rendered,
|
||||
)
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ a.new-timeslot-link { color: lightgray; font-size: large;}
|
|||
<tr>
|
||||
<th scope="row">
|
||||
<span class="room-heading">{{ room.name }}
|
||||
{% if room.functional_name and room.name != room.functional_name %} - {{ room.functional_name }}{% endif %}
|
||||
{% if room.capacity %}<span class="capacity">({{ room.capacity }})</span>{% endif %}
|
||||
</span>
|
||||
</th>
|
||||
|
|
Loading…
Reference in a new issue