You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using sortable inlines, if user has view permission for a model, but not change permission, inlines remain sortable on the user interface.
Of course, the positions changes cannot be saved, but it would be better to disable inlines sorting if user does not have change permission.
Such behaviour can be achieved by modifiying the templates:
stacked.html: replace <h3 class="{% if not inline_opts.sortable_options or not inline_opts.sortable_options.disabled %} djn-drag-handler{% endif %}"> by <h3 class="{% if inline_admin_formset.has_change_permission %}{% if not inline_opts.sortable_options or not inline_opts.sortable_options.disabled %} djn-drag-handler{% endif %}{% endif %}">
tabular.html: replace {% if inline_admin_formset.opts.sortable_field_name %}<span class="djn-drag-handler"></span>{% endif %} by {% if inline_admin_formset.has_change_permission %}{% if inline_admin_formset.opts.sortable_field_name %}<span class="djn-drag-handler"></span>{% endif %}{% endif %}
grappelli and polymorphic templates may be impacted as well.
Does this sound correct to you ?
The text was updated successfully, but these errors were encountered:
When using sortable inlines, if user has view permission for a model, but not change permission, inlines remain sortable on the user interface.
Of course, the positions changes cannot be saved, but it would be better to disable inlines sorting if user does not have change permission.
Such behaviour can be achieved by modifiying the templates:
<h3 class="{% if not inline_opts.sortable_options or not inline_opts.sortable_options.disabled %} djn-drag-handler{% endif %}">
by<h3 class="{% if inline_admin_formset.has_change_permission %}{% if not inline_opts.sortable_options or not inline_opts.sortable_options.disabled %} djn-drag-handler{% endif %}{% endif %}">
{% if inline_admin_formset.opts.sortable_field_name %}<span class="djn-drag-handler"></span>{% endif %}
by{% if inline_admin_formset.has_change_permission %}{% if inline_admin_formset.opts.sortable_field_name %}<span class="djn-drag-handler"></span>{% endif %}{% endif %}
grappelli and polymorphic templates may be impacted as well.
Does this sound correct to you ?
The text was updated successfully, but these errors were encountered: