diff --git a/django_dump_die/templates/django_dump_die/partials/_attributes.html b/django_dump_die/templates/django_dump_die/partials/_attributes.html index dd3797f81178284217658957fe92b12f999dba5a..49eecfeace4265d778bf9825a686716ce6f4392c 100644 --- a/django_dump_die/templates/django_dump_die/partials/_attributes.html +++ b/django_dump_die/templates/django_dump_die/partials/_attributes.html @@ -32,9 +32,11 @@ <span class="{{ css_class }}" title="{{ title }}">{{ attr }}</span>: {% endif %} {% if intermediate %} - {% dump_object value root_obj skip forloop.counter0 new_depth root_index_start root_index_end original_obj True %} - {% else %} + {% dump_object value root_obj skip 0 new_depth root_index_start root_index_end original_obj True %} + {% elif is_iterable %} {% dump_object value root_obj skip forloop.counter0 new_depth root_index_start root_index_end original_obj False %} + {% else %} + {% dump_object value root_obj skip 0 new_depth root_index_start root_index_end original_obj False %} {% endif %} {% endwith %} </li> diff --git a/django_dump_die/templates/django_dump_die/partials/_dump_objects.html b/django_dump_die/templates/django_dump_die/partials/_dump_objects.html index 19d7567bd1bab7679d6d65c8af97732acb4cd456..3c8e8fb5781591af9b2d5c09e7cfa0847c8fbc7e 100644 --- a/django_dump_die/templates/django_dump_die/partials/_dump_objects.html +++ b/django_dump_die/templates/django_dump_die/partials/_dump_objects.html @@ -42,7 +42,7 @@ <span class="empty" title="Dumped Object">Unknown Object</span>: {% endif %} {# Use dump_object template tag to dump object #} - {% dump_object obj obj None forloop.counter0 0 root_index_start root_index_end original_obj %} + {% dump_object obj obj None 0 0 root_index_start root_index_end original_obj %} {% endif %} </div> diff --git a/django_dump_die/templatetags/dump_die.py b/django_dump_die/templatetags/dump_die.py index e869bf664cc1cd48595c39e4ad92e5f6667f6d94..0dfeb6a2255d1db5b210365abe2adc00c0ac6089 100644 --- a/django_dump_die/templatetags/dump_die.py +++ b/django_dump_die/templatetags/dump_die.py @@ -161,7 +161,7 @@ def dump_object( ) # Handle if element is iterable and we are at the root's element direct children (depth of 1), - elif is_iterable(root_obj) and current_depth == 1: + elif is_iterable(root_obj) and current_depth == 0: # Handle unique indexing logic for root element. root_index_start, root_index_end = _process_root_indices( @@ -371,14 +371,14 @@ def is_complex_type(current_depth, current_iteration): # Check if the max_recursion is set to None or we have not reached it yet. ( MAX_RECURSION_DEPTH is None - or current_depth <= MAX_RECURSION_DEPTH + or current_depth < MAX_RECURSION_DEPTH ) # And if the max_iterable_length is set to None, # or we have not reached it yet or we are at the root level. and ( MAX_ITERABLE_LENGTH is None - or current_iteration <= MAX_ITERABLE_LENGTH + or current_iteration < MAX_ITERABLE_LENGTH ) ) ) @@ -522,6 +522,8 @@ def _handle_complex_type( # Attempt to get corresponding attribute/function values of object. attributes, functions = get_obj_values(obj) + is_iterable_obj = is_iterable(obj) and not is_dict(obj) and not isinstance(obj, memoryview) + # Return information required to render object. context = { 'include_attributes': INCLUDE_ATTRIBUTES, @@ -532,7 +534,7 @@ def _handle_complex_type( 'unique': unique, 'root_count': root_count, 'type': get_obj_type(obj), - 'is_iterable': is_iterable(obj), + 'is_iterable': is_iterable_obj, 'depth': current_depth, 'root_index_start': root_index_start, 'root_index_end': root_index_end,