You can use Httpresponse(reverse_lazy('appname'))

On Sun, Apr 19, 2020, 6:35 AM Ahmed Khairy <[email protected]>
wrote:

> For this project, I have made 2 applications: Core and Users
>
> Creating a new user is the 2nd application.
> I am trying to direct the new user after registration to 'home'
>
> I keep getting NoReverse Match Error
>
> This is the view.py this is the code:
>
> def register(request):
>     if request.method == 'POST':
>         form = UserCreationForm(request.POST)
>         if form.is_valid():
>             form.save()
>             username = form.cleaned_data.get('username')
>             messages.success(
>                 request, f'Account created for {username}
> ! Show us your Designs')
>         return redirect('home')
>     else:
>         form = UserCreationForm()
>     return render(request, 'register.html', {'form': form})
>
> This is the url.py in the core application:
>
> urlpatterns = [
>     path('', HomeView.as_view(), name='home'),
>     path('checkout/', checkout, name='checkout'),
>     path('product/<slug>/', ItemDetailView.as_view(), name='product'),
>     path('score/', PostListView.as_view(), name='score'),
>     path('register/', user_views.register, name='register'),
> ]
>
>
> What do I need to do to fix this issue,
>
> Thank you all in advance
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4584668f-3cf5-40fe-930c-69c75b74b23d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4584668f-3cf5-40fe-930c-69c75b74b23d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMeub5OoTnXuJbkyMwY7B8hxr%3D9MLTqwOHX1Wm7S3u5R%3DuX1tg%40mail.gmail.com.

Reply via email to