[Fixed]-Use different view in Django if the url contains specific character

1👍

If you want to deal with it in the same view, leave the urls as they are and change the view:

def url_redirect(request,id):
    if id.startswith('!'):
        id = id[1:]
        # do whatever you want with id
    else:
        url = get_object_or_404(Url,short_id=id)
        return HttpResponseRedirect(url.httpurl)

Leave a comment