"IT Technology bySaikiran" <saikiran.maddipatla1...@gmail.com> – 13. november
2019 15:41
> Views.py:=========def login(request):
> if request.method == 'POST':
> username = request.POST['username']
> password = request.POST['Password1']
> for i in register.objects.all():
> print('db Value'+i.username)
> if i.username == 'saikiran_maddipatla' and i.password == '1919':
> print('Success')
> print('Value not matched')
> print(username)
> print(password)
> user = auth.authenticate(username= username, password= password)
> print(user)
> if user is not None:
> print('Login Success')
> auth.login(request, user)
> return render(register)
> else:
> print("failed")
> return redirect('login')
>
>
> else:
> return render(request, 'web_app/login.html')
>
>
>
>
> Models.py:
>
> =============
>
>
>
>
>
>
> from django.db import models
>
>
> # Create your models here.
> class register(models.Model):
> username=models.CharField(max_length=100)
> password=models.CharField(max_length=100)
> email=models.CharField(max_length=100)
> fname=models.CharField(max_length=30)
> lname=models.CharField(max_length=30)
> user_regdate=models.DateTimeField()
>
> def __str__(self):
> return self.username
>
>
>
>
> i am trying to login,User return None
>
> Please help me on this.
>
>
>
> --
> 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/4191b3c9-ac79-452a-9230-d74558d1901b%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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/20191113163410.Horde.NKMKIoOAxLGxmAdjaaETOEk%40cloud.stacktrace.dk.