From aeac36c410da65d8f048e793bcb4c47ef96af553 Mon Sep 17 00:00:00 2001 From: Ashwin Date: Sat, 2 Feb 2019 15:22:12 +0530 Subject: [PATCH] fixed wrong time in comments and attachments --- accounts/templates/view_account.html | 9 +++++---- cases/templates/view_case.html | 8 +++++--- contacts/models.py | 1 + contacts/templates/view_contact.html | 9 +++++---- leads/templates/view_leads.html | 11 ++++++----- opportunity/templates/view_opportunity.html | 9 +++++---- static/js/cases/view_case.js | 2 +- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/accounts/templates/view_account.html b/accounts/templates/view_account.html index 66117f58..98fe0b90 100644 --- a/accounts/templates/view_account.html +++ b/accounts/templates/view_account.html @@ -163,7 +163,7 @@
{{ attachemnt.file_name }}
{{ attachemnt.created_by }}
-
{{ attachemnt.created_on }}
+
{{ attachemnt.created_on|date:'m/d/Y,  H:i:s A' }}
{% endfor %} @@ -211,7 +211,7 @@
{{ comment.comment }}
{{ comment.commented_by }}
-
{{ comment.commented_on }}
+
{{ comment.commented_on|date:'m/d/Y,  H:i:s A' }}
{% endfor %} @@ -2059,7 +2059,7 @@ "
  • Edit
  • "+ "
  • Remove
  • "+ "
    "+data.comment+"
    "+ - "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " + "
    "+data.commented_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " ) $("#id_comments").val("") alert("Comment Submitted") @@ -2168,11 +2168,12 @@ $("#attachment_form").submit(function (e) { if (data.error) { $("#AttachmentError").html(data.error).show() } else { + d = new Date(data.created_on) $("#attachment_div").prepend( "
  • " + "
    " + "
    "+data.attachment+"
    "+ - "
    "+data.created_by+"
    "+data.created_on+"
    " + + "
    "+data.created_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " + "
  • " ) diff --git a/cases/templates/view_case.html b/cases/templates/view_case.html index 49de4d0d..feb0a106 100644 --- a/cases/templates/view_case.html +++ b/cases/templates/view_case.html @@ -129,7 +129,7 @@
    {{ attachment.file_name }}
    {{ attachment.created_by }}
    -
    {{ attachment.created_on }}
    +
    {{ attachment.created_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -174,7 +174,7 @@
    {{ comment.comment }}
    {{ comment.commented_by }}
    -
    {{ comment.commented_on }}
    +
    {{ comment.commented_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -423,14 +423,16 @@ $("#attachment_form").submit(function (e) { if (data.error) { $("#AttachmentError").html(data.errors).show() } else { + d = new Date(data.created_on) $("#attachment_div").prepend( "
  • " + "
    " + "
    "+data.attachment+"
    "+ - "
    "+data.created_by+"
    "+data.created_on+"
    " + + "
    "+data.created_by+"
    "+d.toLocaleString('en-US', { hour12: true})+"
    " + "
  • " ) $("#AttachmentError").html("") + alert("Attachment Saved") $("#id_attachments").val("") } } diff --git a/contacts/models.py b/contacts/models.py index 62bcf591..9f31880d 100644 --- a/contacts/models.py +++ b/contacts/models.py @@ -25,3 +25,4 @@ class Contact(models.Model): class Meta: unique_together = (("email", ),) + ordering = ['-created_on'] diff --git a/contacts/templates/view_contact.html b/contacts/templates/view_contact.html index 1503bfd0..b5b0abef 100644 --- a/contacts/templates/view_contact.html +++ b/contacts/templates/view_contact.html @@ -118,7 +118,7 @@
    {{ attachemnt.file_name }}
    {{ attachemnt.created_by }}
    -
    {{ attachemnt.created_on }}
    +
    {{ attachemnt.created_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -165,7 +165,7 @@
    {{ comment.comment }}
    {{ comment.commented_by }}
    -
    {{ comment.commented_on }}
    +
    {{ comment.commented_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -244,7 +244,7 @@ $("#comment_form").submit(function (e) { "
  • Edit
  • " + "
  • Remove
  • " + "
    "+data.comment+"
    "+ - "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " + "
    "+data.commented_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " ) $("#id_comments").val("") alert("Comment Submitted") @@ -320,11 +320,12 @@ $("#attachment_form").submit(function (e) { if (data.error) { $("#AttachmentError").html(data.error).show() } else { + d = new Date(data.created_on) $("#attachment_div").prepend( "
  • " + "
    " + "
    "+data.attachment+"
    "+ - "
    "+data.created_by+"
    "+data.created_on+"
    " + + "
    "+data.created_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " + "
  • " ) $("#id_attachments").val("") diff --git a/leads/templates/view_leads.html b/leads/templates/view_leads.html index 19a2c2ee..e5dfa280 100644 --- a/leads/templates/view_leads.html +++ b/leads/templates/view_leads.html @@ -151,7 +151,7 @@
    {{ attachemnt.file_name }}
    {{ attachemnt.created_by }}
    -
    {{ attachemnt.created_on }}
    +
    {{ attachemnt.created_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -197,8 +197,8 @@
    {{ comment.comment }}
    -
    {{ comment.commented_by }}
    -
    {{ comment.commented_on }}
    +
    {{ comment.commented_by}}
    +
    {{ comment.commented_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -280,7 +280,7 @@ $("#comment_form").submit(function (e) { "
  • Edit
  • " + "
  • Remove
  • " + "
    "+data.comment+"
    "+ - "
    "+data.commented_by+"
    "+d.toGMTString()+"
    "+ + "
    "+data.commented_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    "+ "
    " ); $("#id_comments").val("") @@ -355,11 +355,12 @@ $("#attachment_form").submit(function (e) { if (data.error) { $("#AttachmentError").html(data.error).show() } else { + d = new Date(data.created_on) $("#attachment_div").prepend( "
  • " + "
    " + "
    "+data.attachment+"
    "+ - "
    "+data.created_by+"
    "+data.created_on+"
    " + + "
    "+data.created_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " + "
  • " ); $("#id_attachments").val("") diff --git a/opportunity/templates/view_opportunity.html b/opportunity/templates/view_opportunity.html index 90f5c22a..b499973b 100644 --- a/opportunity/templates/view_opportunity.html +++ b/opportunity/templates/view_opportunity.html @@ -149,7 +149,7 @@
    {{ attachemnt.file_name }}
    {{ attachemnt.created_by }}
    -
    {{ attachemnt.created_on }}
    +
    {{ attachemnt.created_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -195,7 +195,7 @@
    {{ comment.comment }}
    {{ comment.commented_by }}
    -
    {{ comment.commented_on }}
    +
    {{ comment.commented_on|date:'m/d/Y,  H:i:s A' }}
    {% endfor %} @@ -282,7 +282,7 @@ assigned_to_list = JSON.parse(assigned_to_list.replace(/&(l|g|quo)t;/g, function "
  • Edit
  • " + "
  • Remove
  • " + "
    "+data.comment+"
    "+ - "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " + "
    "+data.commented_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " ) $("#id_comments").val("") alert("Comment Submitted") @@ -372,11 +372,12 @@ $("#attachment_form").submit(function (e) { if (data.error) { $("#AttachmentError").html(data.error).show() } else { + d = new Date(data.created_on) $("#attachment_div").prepend( "
  • " + "
    " + "
    "+data.attachment+"
    "+ - "
    "+data.created_by+"
    "+data.created_on+"
    " + + "
    "+data.created_by+"
    "+d.toLocaleString('en-US', { hour12: true})+"
    " + "
  • " ) $("#id_attachments").val("") diff --git a/static/js/cases/view_case.js b/static/js/cases/view_case.js index 5fb7f786..6c817085 100644 --- a/static/js/cases/view_case.js +++ b/static/js/cases/view_case.js @@ -22,7 +22,7 @@ $("#comment_form").submit(function (e) { "
  • Edit
  • " + "
  • Remove
  • " + "
    "+data.comment+"
    "+ - "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " + "
    "+data.commented_by+"
    "+d.toLocaleString('en-US', { hour12: true })+"
    " ); $("#id_comments").val(""); alert("Comment Submitted");