mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Do not use annotated_date on custom date fields to avoid date parsing
@jeremystretch: > It'd be better to have the custom field return a date object than to > accommodate string values in the template filter. Let's just omit custom > field dates for now to keep this from getting any more complex.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
{% load helpers %}
|
||||
{% with custom_fields=object.get_custom_fields %}
|
||||
{% if custom_fields %}
|
||||
<div class="panel panel-default">
|
||||
@ -18,8 +17,6 @@
|
||||
<a href="{{ value }}">{{ value|truncatechars:70 }}</a>
|
||||
{% elif field.type == 'multiselect' and value %}
|
||||
{{ value|join:", " }}
|
||||
{% elif field.type == 'date' and value %}
|
||||
{{ value|annotated_date }}
|
||||
{% elif value is not None %}
|
||||
{{ value }}
|
||||
{% elif field.required %}
|
||||
|
@ -162,10 +162,6 @@ def annotated_date(date_value):
|
||||
if not date_value:
|
||||
return ''
|
||||
|
||||
# ../../templates/inc/custom_fields_panel.html passes a string.
|
||||
if type(date_value) == str:
|
||||
date_value = datetime.datetime.strptime(date_value, "%Y-%m-%d").date()
|
||||
|
||||
if type(date_value) == datetime.date:
|
||||
long_ts = date(date_value, 'DATE_FORMAT')
|
||||
short_ts = date(date_value, 'SHORT_DATE_FORMAT')
|
||||
|
Reference in New Issue
Block a user