Skip to content

Commit

Permalink
Show dataproducts on Superblock page
Browse files Browse the repository at this point in the history
  • Loading branch information
zemogle committed Nov 9, 2021
1 parent eeca68e commit 66d53dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions neoexchange/core/templates/core/block_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ <h5 class="section-title">Details of the Block</h5>
</table>
</div>
<div class="four columns">

{% if dataproducts %}
<h5 class="section-title">Data Products</h5>
{% for dp in dataproducts%}
<a href="{{dp.product.url}}">{{dp.get_filetype_display}}</a><br/>
{% endfor %}
{% endif %}
<h5 class="section-title">{% if object.block_set.all%}Observation Blocks{% else%}Controls{% endif %}</h5>
{% if request.user.is_authenticated %}
{% if object.active %}
Expand Down
5 changes: 5 additions & 0 deletions neoexchange/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ class SuperBlockDetailView(DetailView):
template_name = 'core/block_detail.html'
model = SuperBlock

def get_context_data(self, *args, **kwargs):
data = super(SuperBlockDetailView, self).get_context_data(**kwargs)
blockids = self.get_object().block_set.values_list('id',flat=True)
data['dataproducts'] = DataProduct.content.filter(object_id__in=blockids).block()
return data

class SuperBlockTimeline(DetailView):
template_name = 'core/block_timeline.html'
Expand Down

0 comments on commit 66d53dd

Please sign in to comment.