Skip to content
Snippets Groups Projects
Verified Commit 0b147eea authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix assigned_roles.html and AssignGroupRoleView for independent usage

parent e67cff0a
No related branches found
No related tags found
1 merge request!131Resolve "Add support for assinging group roles"
{% load i18n %}
{% load i18n rules %}
{% has_perm "alsijil.assign_grouprole_for_group" user group as can_assign_group_role %}
<div class="collection">
{% for role in roles %}
<div class="collection-item">
......@@ -6,7 +7,7 @@
<div class="col s12 m5 l4 xl3 no-padding">
{% if can_assign_group_role %}
<a class="btn waves-effect waves-light right hide-on-med-and-up"
href="{% url "assign_group_role" group.pk role.pk %}">
href="{% url "assign_group_role" group.pk role.pk %}?next={{ back_url }}">
<i class="material-icons center">add</i>
</a>
{% endif %}
......@@ -19,7 +20,7 @@
<div class="col s12 m7 l8 xl9 no-padding">
{% if can_assign_group_role %}
<a class="btn waves-effect waves-light right hide-on-small-only"
href="{% url "assign_group_role" group.pk role.pk %}">
href="{% url "assign_group_role" group.pk role.pk %}?next={{ back_url }}">
<i class="material-icons center">add</i>
</a>
{% endif %}
......
......@@ -968,14 +968,14 @@ class AssignedGroupRolesView(PermissionRequiredMixin, DetailView):
@method_decorator(never_cache, name="dispatch")
class AssignGroupRoleView(PermissionRequiredMixin, AdvancedCreateView):
class AssignGroupRoleView(PermissionRequiredMixin, SuccessNextMixin, AdvancedCreateView):
model = GroupRoleAssignment
form_class = AssignGroupRoleForm
permission_required = "alsijil.assign_grouprole_for_group"
template_name = "alsijil/group_role/assign.html"
success_message = _("The group role has been assigned.")
def get_success_url(self) -> str:
def get_default_success_url(self) -> str:
return reverse("assigned_group_roles", args=[self.group.pk])
def get_permission_object(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment