15 | | An excetption is raised: |
16 | | |
17 | | {{{ |
18 | | |
19 | | instance = <[AttributeError("'InMemoryFileNode' object has no attribute 'name'") raised in repr()] Attachment object at 0x70e62f1a0ee0> |
20 | | using = <[AttributeError("'InMemoryFileNode' object has no attribute 'name'") raised in repr()] Attachment object at 0x70e62f1a0ee0> |
21 | | def fields_for_model_instance(instance, using=None): |
22 | | ''' |
23 | | Yields (name, descriptor) for each file field given an instance |
24 | | Can use the `using` kwarg to change the instance that the `FieldFile` |
25 | | will receive. |
26 | | ''' |
27 | | if using is None: |
28 | | using = instance |
29 | | model_name = get_model_name(instance) |
30 | | deferred_fields = instance.get_deferred_fields() |
31 | | for field_name in get_fields_for_model(model_name, exclude=deferred_fields): |
32 | | fieldfile = getattr(instance, field_name, None) |
33 | | > yield field_name, fieldfile.__class__(using, fieldfile.field, fieldfile.name) |
34 | | E AttributeError: 'NoneType' object has no attribute 'field' |
35 | | deferred_fields = set() |
36 | | field_name = 'attachment' |
37 | | fieldfile = None |
38 | | instance = <[AttributeError("'InMemoryFileNode' object has no attribute 'name'") raised in repr()] Attachment object at 0x70e62f1a0ee0> |
39 | | model_name = 'tickets.attachment' |
40 | | using = <[AttributeError("'InMemoryFileNode' object has no attribute 'name'") raised in repr()] Attachment object at 0x70e62f1a0ee0> |
41 | | ../.venv/lib/python3.10/site-packages/django_cleanup/cache.py:86: AttributeError |
42 | | }}} |
| 15 | An excetption is raised: `AttributeError("'InMemoryFileNode' object has no attribute 'name'") raised in repr()` |