New task was created
Error when trying to open library item with image type
Created on Tuesday 23 November 2021, 15:55
Back to task list-
ID1009388
-
ProjectMetabolism of Cities
-
StatusOpen
-
PriorityMedium
-
TypeProgramming work
-
Assigned toNo one yet
-
SubscribersGuus Hoekman
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.