[Django]-"Unsafe redirect to URL with protocol 'content-type'" error in Django view

10👍

The get_success_url method should return a URL, not an HTTP response.

def get_success_url(self):
    search = searchViews.getIndexInstance()
    search.mainfunc(self.contentForSearch, self.discussion.pk)
    return reverse('discussion-detail',kwargs={'slug':self.discussion.slug})

It’s not clear what the first two lines are for, they don’t seem to be used by the reverse() call.

Leave a comment