Thursday, November 21, 2019

Re:

my render is not working on calling the detail function : its not helping me to reach the /detail url
  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)   # 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 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 .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'),


On Thu, Nov 21, 2019 at 2:06 PM Kasper Laudrup <laudrup@stacktrace.dk> wrote:
Hi Paras,

On 21/11/2019 06.03, Paras Jain wrote:
> i need the code i am not able to understand by reading documenetation
>

Then I suggest you focus on writing your requirements down and pay
someone to write the code for you.

If you're not even willing to learn, then software development is
clearly not for you.

Kind regards,

Kasper Laudrup

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fa5ab206-1087-0344-a163-f3f4441527ea%40stacktrace.dk.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMtmBS81awo5ap6dJ5E54PCPGPB9SZirtZH-65iSX__H45VGkA%40mail.gmail.com.

No comments:

Post a Comment