Skip to content

Commit

Permalink
Hide save and add another button from edit.html if can_create is False (
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximZemskov committed Apr 11, 2024
1 parent f072409 commit 43bbb84
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sqladmin/templates/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ <h3 class="card-title">Edit {{ model_view.name }}</h3>
<div class="btn-group flex-wrap" data-toggle="buttons">
<input type="submit" name="save" value="Save" class="btn">
<input type="submit" name="save" value="Save and continue editing" class="btn">
{% if model_view.save_as %}
<input type="submit" name="save" value="Save as new" class="btn">
{% else %}
<input type="submit" name="save" value="Save and add another" class="btn">
{% if model_view.can_create %}
{% if model_view.save_as %}
<input type="submit" name="save" value="Save as new" class="btn">
{% else %}
<input type="submit" name="save" value="Save and add another" class="btn">
{% endif %}
{% endif %}
</div>
</div>
Expand All @@ -55,4 +57,4 @@ <h3 class="card-title">Edit {{ model_view.name }}</h3>
</div>
</div>
</div>
{% endblock %}
{% endblock %}

0 comments on commit 43bbb84

Please sign in to comment.