equipement added_at modifed_at
This commit is contained in:
parent
ae0fac4b86
commit
b063d18cf0
3 changed files with 39 additions and 1 deletions
|
@ -73,7 +73,8 @@ class EquipmentAttributeAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
class EquipmentAdmin(admin.ModelAdmin):
|
class EquipmentAdmin(admin.ModelAdmin):
|
||||||
list_display = ['name', 'stock', 'owner', 'category']
|
readonly_fields = ['added_at', 'modified_at']
|
||||||
|
list_display = ['name', 'stock', 'owner', 'category', 'modified_at']
|
||||||
ordering = ['name', 'owner', 'category']
|
ordering = ['name', 'owner', 'category']
|
||||||
inlines = [EquipmentAttributeValueInline,
|
inlines = [EquipmentAttributeValueInline,
|
||||||
EquipmentDefaultExtraInline,
|
EquipmentDefaultExtraInline,
|
||||||
|
|
28
equipment/migrations/0009_auto_20180809_1200.py
Normal file
28
equipment/migrations/0009_auto_20180809_1200.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.11 on 2018-08-09 12:00
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('equipment', '0008_auto_20180808_1454'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='equipment',
|
||||||
|
name='added_at',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2018, 8, 9, 12, 0, 50, 140250, tzinfo=utc), verbose_name='ajouté le'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='equipment',
|
||||||
|
name='modified_at',
|
||||||
|
field=models.DateTimeField(auto_now=True, verbose_name='dernière modification'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -53,6 +53,15 @@ class Equipment(EventSpecificMixin, models.Model):
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
added_at = models.DateTimeField(
|
||||||
|
_("ajouté le"),
|
||||||
|
auto_now_add=True,
|
||||||
|
)
|
||||||
|
modified_at = models.DateTimeField(
|
||||||
|
_("dernière modification"),
|
||||||
|
auto_now=True,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("matériel")
|
verbose_name = _("matériel")
|
||||||
verbose_name_plural = _("matériels")
|
verbose_name_plural = _("matériels")
|
||||||
|
|
Loading…
Reference in a new issue