To add up..I see others comments told you to abstractUser ... this is when
you need to modify the default user maybe to add up other fields in default
user like age or date but from you code above you didn't abstractUser so
follow my previous comment and am sure you code will work

On Sun, Jul 30, 2023, 11:27 Joshua Urasa <urasajosh...@gmail.com> wrote:

> If you use default user there is no need to write your model because is
> there by default so what you need to do create is form.py and inside it
> import usercreationform from then that form import to your view so that to
> handle response and request
>
> On Sun, Jul 30, 2023, 08:34 Prashanth Patelc <prashanthpat...@gmail.com>
> wrote:
>
>> Use default django user model
>>
>> from django.contrib.auth.models import User
>> # Create your models here.
>> class Registration (models.Model):
>>     author = models.ForeignKey(User, on_delete=models.CASCADE)
>>
>> # write your fields here
>>
>>
>>
>> In settings.py
>>
>>
>> AUTH_USER_MODEL = app name . Modelname
>>
>> On Sun, Jul 30, 2023, 10:57 AM Mohammad Ehsan Ansari <
>> mdehsan...@gmail.com> wrote:
>>
>>> First extend abstract user model or abstract base user model in your
>>> user model and after that define auth.model in settings.py hope its work
>>>
>>> Sent from my iPhone
>>>
>>> On 30-Jul-2023, at 10:45 AM, Abdulrahman Abbas <abdouliabba...@gmail.com>
>>> wrote:
>>>
>>> 
>>> Can you login with superuser?
>>>
>>> On Sun, Jul 30, 2023, 02:32 Mh Limon <mhlimon...@gmail.com> wrote:
>>>
>>>> Views.py file
>>>>
>>>> from django.shortcuts import render,HttpResponse,redirect
>>>> from .models import registration
>>>> from django.contrib.auth import authenticate,login
>>>>
>>>> def home(request):
>>>>     return render(request,'home.html')
>>>>
>>>> def log_in(request):
>>>>     if request.method == 'POST':
>>>>         username = request.POST.get('username')
>>>>         password = request.POST.get('password')
>>>>
>>>>         user = authenticate(request, username=username, password=
>>>> password)
>>>>
>>>>         if user is not None:
>>>>             login(request, user)
>>>>             return redirect('home')
>>>>         else:
>>>>             return HttpResponse("You have incorrect Username or
>>>> password")
>>>>
>>>>     return render(request, 'log_in.html')
>>>>
>>>>
>>>> def sign_up(request):
>>>>     if request.method == 'POST':
>>>>         name = request.POST.get('fullname')
>>>>         username = request.POST.get('username')
>>>>         email = request.POST.get('email')
>>>>         pass1 = request.POST.get('password')
>>>>         pass2 = request.POST.get('confirm_password')
>>>>
>>>>         if pass1 != pass2:
>>>>             return HttpResponse("Password not matched")
>>>>         else:
>>>>             db = registration()
>>>>
>>>>             db.Name = name
>>>>             db.username = username
>>>>             db.Email = email
>>>>             db.Password = pass1
>>>>
>>>>             db.save()
>>>>
>>>>             return redirect('log_in')
>>>>
>>>>
>>>>     return render(request,'sign_up.html')
>>>>
>>>> This is models.py for sqlite database:
>>>> from django.db import models
>>>>
>>>> class registration(models.Model):
>>>>     Name = models.CharField(max_length=100)
>>>>     username = models.CharField(max_length=100)
>>>>     Email = models.CharField(max_length=100)
>>>>     Password = models.CharField(max_length=100)
>>>>
>>>>
>>>> when providing the correct username and password, the system
>>>> consistently displays an error message stating "You have incorrect Username
>>>> or password."
>>>>
>>>> please help me to solve this error.
>>>>
>>>>
>>>>
>>>> --
>>>> 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/4003937f-9045-4cea-bd6c-b071d7b1a6c3n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/4003937f-9045-4cea-bd6c-b071d7b1a6c3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAGGqo0MMu55nqSSKhW2%2BjGgGCGf62JJoBuCZA2wgK3NONCxzCg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAGGqo0MMu55nqSSKhW2%2BjGgGCGf62JJoBuCZA2wgK3NONCxzCg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> 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/BF995111-54EC-4CD1-A3E8-FE4F35AE49B1%40gmail.com
>>> <https://groups.google.com/d/msgid/django-users/BF995111-54EC-4CD1-A3E8-FE4F35AE49B1%40gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAMCU6CrPDJKA0riTFhZcPLp8MAhqRs3-XZiDrgZNF2PNWAz2Zw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMCU6CrPDJKA0riTFhZcPLp8MAhqRs3-XZiDrgZNF2PNWAz2Zw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CAErC-gMTub%2BV4u7xHnPeLOX-0AvtDg%3D%2BtatwrP_%3DAfLGTY4mvg%40mail.gmail.com.

Reply via email to