Error when trying to open library item with image type

Created on Tuesday 23 November 2021, 15:55

Back to task list
  • ID
    1009388
  • Project
    Metabolism of Cities
  • Status
    Open
  • Priority
    Medium
  • Type
    Programming work
  • Assigned to
    No one yet
  • Subscribers
    Guus Hoekman

You are not logged in

Log In Register

Please join us and let's build things, together!

Description

When you add a library item and set the type to image, it's possible to save it (through the admin section anyway). However, when trying to open it you will get this error:

```
RelatedObjectDoesNotExist at /library/items/984878/

LibraryItem has no photo.

...

/src/library/views.py, line 321, in item
```

Line 321 shows info.photo. That's probably not right because it should be info.image.

However, when changing it to info.image you'll get another error:

```
AttributeError at /library/items/984878/

'StdImageFieldFile' object has no attribute 'type'
```

Then it mentions /src/library/views.py, line 326, in item.

But line 326 is just an if statement if info.type.id == 40:. And the ID of an Image isn't even 40, so I'm not sure how that's relevant.

Discussion and updates


New task was created