[Fixed]-Django: admin login with parameter

1👍

You can set query_string to True, so that query strings are appended to the URL.

RedirectView(
    url=reverse_lazy('admin:login'),
    query_string=True,
    # You might want to set permanent=False, 
    # as it defaults to True for Django < 1.9
    permanent=False, 
)

Note that Django comes with a built in login view. You can enable it by adding the URL pattern and a simple template, which isn’t much more work than your code above.

Leave a comment