mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add "upload date" field to fileattachment base class
This commit is contained in:
parent
d4fa7d936e
commit
5d716d0cdd
@ -42,6 +42,8 @@ class InvenTreeAttachment(models.Model):
|
||||
Attributes:
|
||||
attachment: File
|
||||
comment: String descriptor for the attachment
|
||||
user: User associated with file upload
|
||||
upload_date: Date the file was uploaded
|
||||
"""
|
||||
def getSubdir(self):
|
||||
"""
|
||||
@ -63,6 +65,8 @@ class InvenTreeAttachment(models.Model):
|
||||
help_text=_('User'),
|
||||
)
|
||||
|
||||
upload_date = models.DateField(auto_now_add=True, null=True, blank=True)
|
||||
|
||||
@property
|
||||
def basename(self):
|
||||
return os.path.basename(self.attachment.name)
|
||||
|
23
InvenTree/order/migrations/0034_auto_20200512_1054.py
Normal file
23
InvenTree/order/migrations/0034_auto_20200512_1054.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.0.5 on 2020-05-12 10:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('order', '0033_auto_20200512_1033'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='purchaseorderattachment',
|
||||
name='upload_date',
|
||||
field=models.DateField(auto_now_add=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='salesorderattachment',
|
||||
name='upload_date',
|
||||
field=models.DateField(auto_now_add=True, null=True),
|
||||
),
|
||||
]
|
18
InvenTree/part/migrations/0037_partattachment_upload_date.py
Normal file
18
InvenTree/part/migrations/0037_partattachment_upload_date.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.5 on 2020-05-12 10:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('part', '0036_partattachment_user'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='partattachment',
|
||||
name='upload_date',
|
||||
field=models.DateField(auto_now_add=True, null=True),
|
||||
),
|
||||
]
|
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.5 on 2020-05-12 10:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0037_stockitemattachment_user'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='stockitemattachment',
|
||||
name='upload_date',
|
||||
field=models.DateField(auto_now_add=True, null=True),
|
||||
),
|
||||
]
|
@ -22,7 +22,7 @@
|
||||
<tr>
|
||||
<th data-field='file' data-searchable='true'>{% trans "File" %}</th>
|
||||
<th data-field='comment' data-searchable='true'>{% trans "Comment" %}</th>
|
||||
<th data-field='user' data-searchable='true'>{% trans "Uploaded By" %}</th>
|
||||
<th data-field='user' data-searchable='true'>{% trans "Uploaded" %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -32,7 +32,8 @@
|
||||
<td><a href='/media/{{ attachment.attachment }}'>{{ attachment.basename }}</a></td>
|
||||
<td>{{ attachment.comment }}</td>
|
||||
<td>
|
||||
{% if attachment.user %}{{ attachment.user.username }}{% else %}-{% endif %}
|
||||
{% if attachment.upload_date %}{{ attachment.upload_date }}{% endif %}
|
||||
{% if attachment.user %}<span class='badge'>{{ attachment.user.username }}</div>{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<div class='btn-group' style='float: right;'>
|
||||
|
Loading…
x
Reference in New Issue
Block a user