Hi Gil,

please see

views.cregister

def cregister(request):
    next = request.GET.get('next')
    form = CUserRegisterForm(request.POST or None)
    if form.is_valid():
        user = form.save(commit=False)
        password1 = form.cleaned_data.get('password1')
        password1 = form.cleaned_data.get('password2')
        user.setpassword(password1)
        user.setpassword(password2)
        user.save()
        new_user = authenticate(username=username, password=password)
        login(request, user)
        if next:
            return redirect('next')
        return redirect('cpage')

    context = {

        'form': form,

    }
    return render(request, "cregister.html", context)

projectname/urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('core.urls')),
]

Best,

K
On 26 Aug 2019, at 18:29, Gil Obradors <[email protected]> wrote:

> Hi!
> 
> Can you paste views.cregister
> and projectname/urls.py ?
> 
> 
> 
> Missatge de Kean <[email protected]> del dia dl., 26 d’ag. 2019 a les 19:10:
> Hi, 
> 
> I'm new to Django. I created several urls, in urls.py, however, when I try to 
> navigate to the URL it says page not found.
> Page not found (404)
> Request Method:       GET
> Request URL:  http://127.0.0.1:8000/register
> Using the URLconf defined in bnt.urls, Django tried these URL patterns, in 
> this order:
> 
> admin/
> [name='home']
> /login [name='clogin']
> /login/customer [name='cpage']
> /register [name='cregister']
> /register/customer [name='cpage']
> The current path, register, didn't match any of these.
> 
> 
> 
> 
> 
> 
> urls.py
> 
> from django.conf.urls import url
> from django.urls import path
> from . import views
> 
> urlpatterns = [
> 
>     path('', views.home, name='home'),
>     path('/login', views.clogin, name='clogin'),
>     path('/login/customer', views.cpage, name='cpage'),
>     path('/register', views.cregister, name='cregister'),
>     path('/register/customer', views.cpage, name='cpage'),
>     path('/logout', views.clogout, name='clogout'),
>     
> ]
> 
> 
> Please can anyone advise, if they had this issue and how they resolved,
> 
> Best,
> 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/8a72d003-fcf7-4280-8635-6f4986f3e002%40googlegroups.com.
> 
> -- 
> 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/CAK-JoTTb_a4392MBgNy12vVCayYtsxzijfC%3DznY3NK5kP5Bcfg%40mail.gmail.com.

-- 
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/AE4A7AB2-C1BA-42DE-8C45-44D8B3133FCC%40gmail.com.

Reply via email to