Changed tracking into to datetime field

- Added moment.js for formatting dates
-
This commit is contained in:
Oliver 2018-05-10 21:13:36 +10:00
parent 7b478fed4e
commit dcf74292b6
6 changed files with 14413 additions and 3 deletions

View File

@ -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,

File diff suppressed because it is too large Load Diff

View 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),
),
]

View File

@ -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)

View File

@ -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',

View File

@ -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>