mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Changed tracking into to datetime field
- Added moment.js for formatting dates -
This commit is contained in:
parent
7b478fed4e
commit
dcf74292b6
@ -93,7 +93,8 @@ TEMPLATES = [
|
||||
]
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'EXCEPTION_HANDLER': 'rest_framework.views.exception_handler'
|
||||
'EXCEPTION_HANDLER': 'rest_framework.views.exception_handler',
|
||||
'DATETIME_FORMAT': '%Y-%m-%d %H:%M',
|
||||
# 'EXCEPTION_HANDLER': 'InvenTree.utils.api_exception_handler',
|
||||
# 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
# 'PAGE_SIZE': 50,
|
||||
|
14380
InvenTree/static/script/moment.js
Normal file
14380
InvenTree/static/script/moment.js
Normal file
File diff suppressed because it is too large
Load Diff
20
InvenTree/stock/migrations/0003_auto_20180510_1042.py
Normal file
20
InvenTree/stock/migrations/0003_auto_20180510_1042.py
Normal file
@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-05-10 10:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0002_auto_20180430_1218'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='stockitemtracking',
|
||||
name='date',
|
||||
field=models.DateTimeField(auto_now_add=True),
|
||||
),
|
||||
]
|
@ -329,7 +329,7 @@ class StockItemTracking(models.Model):
|
||||
related_name='tracking_info')
|
||||
|
||||
# Date this entry was created (cannot be edited)
|
||||
date = models.DateField(auto_now_add=True, editable=False)
|
||||
date = models.DateTimeField(auto_now_add=True, editable=False)
|
||||
|
||||
# Short-form title for this tracking entry
|
||||
title = models.CharField(max_length=250)
|
||||
|
@ -186,6 +186,15 @@
|
||||
field: 'date',
|
||||
title: 'Date',
|
||||
sortable: true,
|
||||
formatter: function(value, row, index, field) {
|
||||
var m = moment(value);
|
||||
if (m.isValid()) {
|
||||
var html = m.format('dddd MMMM Do YYYY') + '<br>' + m.format('h:mm a');
|
||||
return html;
|
||||
}
|
||||
|
||||
return 'N/A';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
|
@ -60,7 +60,7 @@ InvenTree
|
||||
|
||||
<script type='text/javascript' src="{% static 'script/bootstrap-table.min.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/bootstrap-table-en-US.min.js' %}"></script>
|
||||
|
||||
<script type='text/javascript' src="{% static 'script/moment.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/tables.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/sidenav.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/notification.js' %}"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user