Skip to content

Commit

Permalink
Fix querystring in admin template navs/export.
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Feb 14, 2023
1 parent 80e19cc commit 25c1a07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions flask_peewee/templates/admin/models/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

{% block pre_content %}
<ul class="nav nav-tabs">
<li class="{% block tab_index_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('index')) }}?{{ request.query_string }}">{{ model_admin.get_display_name()|fix_underscores }} ({{ model_admin.get_query().count() }})</a></li>
<li class="{% block tab_index_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('index')) }}?{{ request.query_string.decode('utf8') }}">{{ model_admin.get_display_name()|fix_underscores }} ({{ model_admin.get_query().count() }})</a></li>
<li class="{% block tab_add_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('add')) }}">Add new</a></li>
<li class="{% block tab_export_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('export')) }}?{{ request.query_string }}">Export</a></li>
<li class="{% block tab_export_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('export')) }}?{{ request.query_string.decode('utf8') }}">Export</a></li>
{% block extra_tabs %}{% endblock %}
</ul>
{% endblock %}
4 changes: 2 additions & 2 deletions flask_peewee/templates/admin/models/export.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4 id="export-summary">Currently {{ query.count() }} records are scheduled for
</div>
</div>

<form action="./?{{ request.query_string }}" class="form-horizontal" method="post">
<form action="./?{{ request.query_string.decode('utf8') }}" class="form-horizontal" method="post">
<fieldset>
{% if csrf_token %}{# Support for flask-seasurf #}<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">{% endif %}
<legend>Select fields to export</legend>
Expand Down Expand Up @@ -56,7 +56,7 @@ <h4 id="export-summary">Currently {{ query.count() }} records are scheduled for

<div class="form-actions">
<button class="btn btn-primary" type="submit">Export JSON</button>
<a class="btn" href="{{ url_for(model_admin.get_url_name('index')) }}?{{ request.query_string }}">Cancel</a>
<a class="btn" href="{{ url_for(model_admin.get_url_name('index')) }}?{{ request.query_string.decode('utf8') }}">Cancel</a>
</div>
</fieldset>
</form>
Expand Down

0 comments on commit 25c1a07

Please sign in to comment.