Skip to content

Commit

Permalink
Show results from each image in admin (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanep97 authored Dec 11, 2024
1 parent 100a542 commit ba4967b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iop4admin/templates/iop4admin/view_fitdetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ <h3>Sources in the field</h3>
{% endif %}

<h3>Results from this image</h3>
<i>Not implemented.</i>

Link to results <a href="{{ photopolresults_url }}">{{ photopolresults_text }}</a><br>



Expand Down
12 changes: 12 additions & 0 deletions iop4admin/views/fitfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ def get_context_data(self, **kwargs):
# stats
context["stats"] = obj.stats

# Results from this images

if isinstance(obj, ReducedFit):
qs_results = PhotoPolResult.objects.filter(reducedfits__in=[obj.id]).all()
if qs_results.exists():
ids_str_L = [str(res.id) for res in qs_results]
a_href = reverse('iop4admin:%s_%s_changelist' % (PhotoPolResult._meta.app_label, PhotoPolResult._meta.model_name)) + "?id__in=%s" % ",".join(ids_str_L)
a_text = ", ".join(ids_str_L)
context["photopolresults"] = qs_results
context["photopolresults_url"] = a_href
context["photopolresults_text"] = a_text

#logger.debug("Finished building template context for fit details view")

return context
Expand Down

0 comments on commit ba4967b

Please sign in to comment.