0001-WIP-backoffice-support-next-url-after-user-creation-.patch
src/authentic2/manager/templates/authentic2/manager/form.html | ||
---|---|---|
91 | 91 |
} |
92 | 92 |
}) |
93 | 93 |
</script> |
94 |
<div class="hidden_inputs"> |
|
95 |
{% block hidden_inputs %} |
|
96 |
{% endblock %} |
|
97 |
</div> |
|
94 | 98 |
</form> |
95 | 99 |
{% endblock %} |
src/authentic2/manager/templates/authentic2/manager/user_add.html | ||
---|---|---|
5 | 5 |
{% trans "Add an user" %} |
6 | 6 |
{% endblock %} |
7 | 7 | |
8 |
{% block hidden_inputs %} |
|
9 |
{{ block.super }} |
|
10 |
{% if next_url %}<input type="hidden" name="next_url" value="{{ next_url}}">{% endif %} |
|
11 |
{% endblock %} |
|
12 | ||
8 | 13 |
{% block breadcrumb %} |
9 | 14 |
{{ block.super }} |
10 | 15 |
<a href="{% url 'a2-manager-users' %}{% if multiple_ou and ou %}?search-ou={{ ou.pk }}{% endif %}">{% trans 'Users' %}{% if multiple_ou and ou %} : {{ ou }}{% endif %}</a> |
src/authentic2/manager/user_views.py | ||
---|---|---|
129 | 129 |
return fields |
130 | 130 | |
131 | 131 |
def get_success_url(self): |
132 |
return reverse('a2-manager-user-detail', kwargs={'pk': self.object.pk}) |
|
132 |
return self.request.POST.get('next_url') or \ |
|
133 |
reverse('a2-manager-user-detail', kwargs={'pk': self.object.pk}) |
|
133 | 134 | |
134 | 135 |
def get_context_data(self, **kwargs): |
135 | 136 |
context = super(UserAddView, self).get_context_data(**kwargs) |
136 | 137 |
context['cancel_url'] = '../..' |
137 | 138 |
context['ou'] = self.ou |
139 |
if hasattr(self.request, 'GET') and 'next_url' in self.request.GET: |
|
140 |
context['next_url'] = self.request.GET['next_url'] |
|
138 | 141 |
return context |
139 | 142 | |
140 | 143 |
def form_valid(self, form): |
141 |
- |