Skip to content

Commit

Permalink
Navigation back from Detail to List with filters preserved
Browse files Browse the repository at this point in the history
moreover, now it is possible to get back from any related model Detail view inside the iframe
  • Loading branch information
RyabykinIlya committed May 23, 2020
1 parent 05fa46a commit b9db782
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion simpleui/templates/admin/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
el: '.page-header',
methods: {
goBack: function () {
window.location.href = '{% get_model_url %}'
window.location.href = '{% get_previous_url %}'
}
}
})
Expand Down
4 changes: 4 additions & 0 deletions simpleui/templatetags/simpletags.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,3 +478,7 @@ def get_boolean_choices():
('True', _('Yes')),
('False', _('No'))
)

@register.simple_tag(takes_context=True)
def get_previous_url(context):
return context.request.META.get('HTTP_REFERER')

0 comments on commit b9db782

Please sign in to comment.