Hello, Im trying to create a redirect where after the user has created a login, and saved they are redirected to a sub.url i.e. Business registers, at Business register.url and is redirected to business register/business admin.url
my views.py def Business(request): if request.method == "POST": form = UserCreationForm(request.POST) if form.is_valid(): user = form.save() username = form.cleaned_data.get('username') messages.success(request, f"New Account Created: {username}") login(request, user) message.info(request, f"You are now logged in as: {username}") return redirect("source:contadmin") else: for msg in form.error_messages: messages.error(request, f"{msg}: {form.error_messages[msg]}") form = UserCreationForm(request.POST) return render(request, "source/Business register.html", context={"form":form}) def contadmin(request): return render(request=request, template_name="source/busadmin.html") my urls.py from django.urls import path from . import views app_name = "source" urlpatterns = [ path("", views.homepage, name="homepage"), path("Business register/", views.Business, name="Business register"), path("contadmin", views.contadmin, name="busadmin"), ] my html.template for the sub.url {% load static %} <!-- Compiled and minified CSS --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> <!-- Compiled and minified JavaScript --> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script> <nav> <div class="nav-wrapper"> <a href="/" class="brand-logo">Billntrade</a> <ul id="nav-mobile" class="right hide-on-med-and down"> <li><a href="/Business admin">Business admin</a></li> <li><a href="/Business logout">Business logout</a></li> <li><a href="/>Help">Help</a></li> </ul> </div> </nav> <div class="container"> <br> I am new to django, and was hoping the community can help with a solution, Best wishes, K -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/84115da8-71d6-4439-a5c3-bdb3b28003fd%40googlegroups.com.