Make it possible to fully delete unlisted/unrated extensions #81
@ -103,10 +103,14 @@
|
|||||||
<a href="{{ version.update_url }}" class="btn">
|
<a href="{{ version.update_url }}" class="btn">
|
||||||
<i class="i-edit"></i><span>Edit</span>
|
<i class="i-edit"></i><span>Edit</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ version.get_delete_url }}" class="btn btn-danger">
|
{% with cannot_be_deleted_reasons=version.cannot_be_deleted_reasons %}
|
||||||
<i class="i-trash"></i>
|
{% if not cannot_be_deleted_reasons %}
|
||||||
<span>{% trans "Delete Version" %}</span>
|
<a href="{{ version.get_delete_url }}" class="btn btn-danger">
|
||||||
</a>
|
<i class="i-trash"></i>
|
||||||
|
<span>{% trans "Delete Version" %}</span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -193,6 +193,7 @@ class DeleteExtensionView(
|
|||||||
class VersionDeleteView(
|
class VersionDeleteView(
|
||||||
LoginRequiredMixin,
|
LoginRequiredMixin,
|
||||||
MaintainedExtensionMixin,
|
MaintainedExtensionMixin,
|
||||||
|
UserPassesTestMixin,
|
||||||
DeleteView,
|
DeleteView,
|
||||||
):
|
):
|
||||||
model = Version
|
model = Version
|
||||||
@ -232,6 +233,14 @@ class VersionDeleteView(
|
|||||||
context['confirm_url'] = version.get_delete_url()
|
context['confirm_url'] = version.get_delete_url()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
def test_func(self) -> bool:
|
||||||
|
obj = self.get_object()
|
||||||
|
# Unless this version cannot be deleted anymore
|
||||||
|
cannot_be_deleted_reasons = obj.cannot_be_deleted_reasons
|
||||||
|
if len(cannot_be_deleted_reasons) > 0:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ManageVersionsView(
|
class ManageVersionsView(
|
||||||
LoginRequiredMixin,
|
LoginRequiredMixin,
|
||||||
|
Loading…
Reference in New Issue
Block a user