12117 remove clone button if no params

This commit is contained in:
Arthur 2023-03-31 13:43:48 -07:00
parent 6b14186674
commit 13cdefe52c
4 changed files with 4 additions and 11 deletions

View File

@ -4,9 +4,6 @@
{% load perms %}
{% load plugins %}
{# cable does not support the default clone control #}
{% block clone_button %}{% endblock clone_button %}
{% block content %}
<div class="row">
<div class="col col-md-6">

View File

@ -60,23 +60,15 @@ Context:
{# Extra buttons #}
{% block extra_controls %}{% endblock %}
{% block clone_button %}
{% if request.user|can_add:object %}
{% clone_button object %}
{% endif %}
{% endblock clone_button %}
{% block edit_button %}
{% if request.user|can_change:object %}
{% edit_button object %}
{% endif %}
{% endblock edit_button %}
{% block delete_button %}
{% if request.user|can_delete:object %}
{% delete_button object %}
{% endif %}
{% endblock delete_button %}
</div>
<div class="control-group">

View File

@ -1,3 +1,5 @@
{% if url %}
<a href="{{ url }}" class="btn btn-sm btn-success" role="button">
<i class="mdi mdi-content-copy" aria-hidden="true"></i>&nbsp;Clone
</a>
{% endif %}

View File

@ -20,6 +20,8 @@ def clone_button(instance):
param_string = prepare_cloned_fields(instance).urlencode()
if param_string:
url = f'{url}?{param_string}'
else:
url = None
return {
'url': url,