mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
Return to previous page after Edit profile
Use a parameter to pass the current page to the Edit Profile URL so that saving or cancelling returns you to that same page. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
61dd9527ba
commit
b767d709ff
|
@ -844,6 +844,7 @@ class EditProfileFormView(SuccessMessageMixin, UpdateView):
|
|||
else:
|
||||
error_fields = form.errors.keys()
|
||||
context['error_fields'] = error_fields
|
||||
context['return_url'] = self.get_success_url()
|
||||
return context
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
|
@ -870,7 +871,7 @@ class EditProfileFormView(SuccessMessageMixin, UpdateView):
|
|||
return "Profile saved successfully"
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('frontpage')
|
||||
return self.request.GET.get('return_to', reverse('frontpage'))
|
||||
|
||||
|
||||
@receiver(pre_save, sender=reversion.models.Version)
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<ul class="dropdown-menu">
|
||||
<li><a href="{% url 'auth_logout' %}">{% trans "Log out" %}</a></li>
|
||||
<li><a href="{% url 'auth_password_change' %}">{% trans "Change password" %}</a></li>
|
||||
<li><a href="{% url 'profile' %}">{% trans "Edit profile" %}</a></li>
|
||||
<li><a href="{% url 'profile' %}?return_to={{ request.path }}">{% trans "Edit profile" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
{% endfor %}
|
||||
|
||||
<input type="submit" class="btn btn-default" value="{% trans 'Save' %}" />
|
||||
<a class="btn btn-default" href="{% url 'frontpage' %}">{% trans 'Cancel' %}</a>
|
||||
<a class="btn btn-default" href="{{ return_url }}">{% trans 'Cancel' %}</a>
|
||||
<a class="btn btn-danger" href="{% url 'delete_account' %}">{% trans 'Delete account' %}</a>
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue
Block a user