my render function its not working in detail function its not rendering to
detail.html.please help any one

views.py:
def detail(request,user):
    print('hobbies : ', user.hobbies)
    return render(request, 'company/detail.html',{'details':user})

def login(request):
    if request.method == 'POST':
        email  = request.POST['email']
        password = request.POST['password']

        user = User.objects.get(email=email)

        if user.password == password:

            if user.type == 'Manager':
                return redirect('company-add')

            if user.type == 'Normal':
                print('hobbies : ', user.hobbies)
                return detail(request, user)     #calling the detail
function
        else:
            messages.success(request, 'invalids credentials')
            return redirect('company-login')

    else:
        return render(request, 'company/login.html')

urls.py
from django.urls import path
from .import views

urlpatterns=[
    path('', views.home, name='company-home'),
    path('register/', views.register, name='company-register'),
    path('detail/', views.detail, name='company-detail'),
    path('login/', views.login, name='company-login'),
    path('add/', views.add, name='company-add'),

]

-- 
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/CAMtmBS-nQC5D1XGdSJxck2E46ouMdAmNciE58LcbwBCVpVCBjw%40mail.gmail.com.
  • [no subject] Paras Jain
    • Re: Jordan Micle
      • Re: Paras Jain

Reply via email to