diff --git a/admin/nodes/views.py b/admin/nodes/views.py index 71c3f60e965..74321c8f908 100644 --- a/admin/nodes/views.py +++ b/admin/nodes/views.py @@ -14,7 +14,6 @@ View, FormView, ListView, - TemplateView, ) from django.shortcuts import redirect, reverse, get_object_or_404 from django.urls import reverse_lazy @@ -102,12 +101,16 @@ def get_context_data(self, **kwargs): node = self.get_object() detailed_duplicates = detect_duplicate_notifications(node_id=node.id) - + children = node.get_nodes(is_node_link=False) + # Annotate guid because django templates prohibit accessing attributes that start with underscores + children = AbstractNode.objects.filter( + id__in=[child.id for child in children] + ).prefetch_related('guids').annotate(guid=F('guids___id')) context.update({ 'SPAM_STATUS': SpamStatus, 'STORAGE_LIMITS': settings.StorageLimits, 'node': node, - 'children': node.get_nodes(is_node_link=False), + 'children': children, 'duplicates': detailed_duplicates }) @@ -194,10 +197,9 @@ def add_contributor_removed_log(self, node, user): ).save() -class NodeDeleteView(NodeMixin, TemplateView): +class NodeDeleteView(NodeMixin, View): """ Allows authorized users to mark nodes as deleted. """ - template_name = 'nodes/remove_node.html' permission_required = ('osf.view_node', 'osf.delete_node') raise_exception = True diff --git a/admin/templates/nodes/children.html b/admin/templates/nodes/children.html index 02f92a398ea..a24ba567c07 100644 --- a/admin/templates/nodes/children.html +++ b/admin/templates/nodes/children.html @@ -18,9 +18,7 @@ {% for child in children %} - - {{ child.id }} - + {{ child.guid }} {{ child.title }} {{ child.is_public }} @@ -29,26 +27,19 @@ {% if not child.is_registration %} {% if child.deleted %} -
+ {% csrf_token %}
{% else %} - - Delete Node - - +
+ {% csrf_token %} + +
{% endif %} {% endif %}