Commit 863a0595 authored by jocelyn's avatar jocelyn

Save some horizontal space in items admin listing

parent ee8eb45e
......@@ -59,7 +59,8 @@ class AvailabilityFilter(admin.SimpleListFilter):
class LoanHistoryInline(admin.TabularInline):
model = Loan
extra = 0
readonly_fields = ('user', 'item', 'loan_date', 'loan_date_end', 'notes')
fields = ('user', 'item', 'short_date', 'short_date_end', 'notes')
readonly_fields = ('user', 'item', 'short_date', 'short_date_end', 'notes')
ordering = ['-loan_date_end']
verbose_name_plural = "Historique de prêt de cet objet"
show_change_link = True
......@@ -165,6 +165,17 @@ class Loan(models.Model):
get_mac_and_serial.short_description = "Adresse MAC / n° de série"
def short_date(self):
return '{:%d/%m/%y}'.format(self.loan_date)
short_date.short_description = "Emprunté le…"
def short_date_end(self):
if self.loan_date_end:
return '{:%d/%m/%y}'.format(self.loan_date_end)
return None
short_date_end.short_description = "Rendu le…"
def user_can_close(self, user):
return (not self.item.is_available()) and (self.user == user)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment