[Answer]-Django views and URl's

1πŸ‘

βœ…

You need to actually redirect the user to β€˜/account/’. Rather than returning a call to render you can do the following:

from django.http import HttpResponseRedirect

def updatetext(request, fb_id):
    Account.objects.filter(id=fb_id).update(display_hashtag=request.POST['hashtag'])

    fb = get_object_or_404(Account, pk=fb_id)
    return HttpResponseRedirect(reverse('account', kwargs={"fb_id": fb_id}))

However, it would be better to pass in a call to reverse into the HttpResponseRedirect constructor, but since I don’t know your urls.py I just wrote the relative url.

πŸ‘€schillingt

Leave a comment