Make it possible to fully delete unlisted/unrated extensions #81
@ -103,10 +103,14 @@
|
||||
<a href="{{ version.update_url }}" class="btn">
|
||||
<i class="i-edit"></i><span>Edit</span>
|
||||
</a>
|
||||
<a href="{{ version.get_delete_url }}" class="btn btn-danger">
|
||||
<i class="i-trash"></i>
|
||||
<span>{% trans "Delete Version" %}</span>
|
||||
</a>
|
||||
{% with cannot_be_deleted_reasons=version.cannot_be_deleted_reasons %}
|
||||
{% if not cannot_be_deleted_reasons %}
|
||||
<a href="{{ version.get_delete_url }}" class="btn btn-danger">
|
||||
<i class="i-trash"></i>
|
||||
<span>{% trans "Delete Version" %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -193,6 +193,7 @@ class DeleteExtensionView(
|
||||
class VersionDeleteView(
|
||||
LoginRequiredMixin,
|
||||
MaintainedExtensionMixin,
|
||||
UserPassesTestMixin,
|
||||
DeleteView,
|
||||
):
|
||||
model = Version
|
||||
@ -232,6 +233,14 @@ class VersionDeleteView(
|
||||
context['confirm_url'] = version.get_delete_url()
|
||||
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(
|
||||
LoginRequiredMixin,
|
||||
|
Loading…
Reference in New Issue
Block a user