New task was created
Integrate image in reference space database field
Created on Wednesday 18 November 2020, 07:29Back to task list
ProjectMetabolism of Cities Data Hub
Assigned toPaul Hoekman
Right now, we have a dynamically generated @property in the ReferenceSpace model, which in fact is a lookup of the Photo table, and it selects the first pic there. So far, so good. However, it does mean that we do a single lookup for every space that we loop through. And we can't do prefetch_related as this isn't a regular foreign key relationship. What we should do instead is copy that photo URL to the image field which exists on every Record (of which ReferenceSpace is a derived model), and simply use signals to update them where needed. Would save a lot of queries.