File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
src/django_smartbase_admin
templates/sb_admin/inlines Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,17 @@ def datetime_formatter(object_id, value):
1212
1313def datetime_formatter_with_format (date_format = None , time_format = None ):
1414 def inner_formatter (object_id , value ):
15+ if value is None :
16+ return None
1517 value = timezone .localtime (value )
16- return f"{ date (value , date_format )} { time (value , time_format )} "
18+ return_value = ""
19+ if date_format :
20+ return_value += date (value , date_format )
21+ if time_format :
22+ if return_value :
23+ return_value += " "
24+ return_value += time (value , time_format )
25+ return return_value
1726
1827 return inner_formatter
1928
Original file line number Diff line number Diff line change 11{% load admin_urlname admin_urlquote from admin_urls %}
2- {% load i18n nested_admin static widget_tweaks %}
2+ {% load i18n nested_admin static widget_tweaks sb_admin_tags %}
33
44{% with inline_admin_formset.formset.is_nested as is_nested %}
55
66 {% with inline_admin_formset.opts as inline_opts %}
77 < div
8- class ="card p-0 sm:mb-24 inline-group group djn-group djn-tabular{% if is_nested %} djn-group-nested{% else %} djn-group-root{% endif %} "
8+ class ="{% if inline_admin_formset.opts.class_name %}{{ inline_admin_formset.opts.class_name }}{% else %}{{ inline_admin_formset.opts|to_class_name|slugify }}{% endif %}{% if inline_admin_formset.formset.can_delete %} can-delete{% endif %} card p-0 sm:mb-24 inline-group group djn-group djn-tabular{% if is_nested %} djn-group-nested{% else %} djn-group-root{% endif %} "
99 id ="{{ inline_admin_formset.formset.prefix }}-group "
1010 data-inline-type ="stacked "
1111 data-inline-formset ="{{ inline_admin_formset.inline_formset_data }} "
You can’t perform that action at this time.
0 commit comments