i am not rendring to detail page
views.py:
def detail(request):
    #print('hobbies : ', user.hobbies)
    return render(request, 'company/detail.html',{'details':request.user})

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

        user = User.objects.get(email=email)   # get will fetch details
from database and it will match value with post

        if user.password == password:

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

            if user.type == 'Normal':
                print('hobbies : ', user.hobbies)
                return HttpResponseRedirect(reverse('company-detail'),user)
                # return redirect('company-detail',user)
                # return detail(request,user)
        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 django.conf.urls import  url
#from .views import HomePageView
from .import views

urlpatterns=[
    path('', views.home, name='company-home'),
    path('register/', views.register, name='company-register'),
    path('detail/<int:pk>', 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_2fitTNfxc8uzQW%2BeWXqexTijnO7ePcYha63iLWtS9GQ%40mail.gmail.com.

Reply via email to