Import the User model in your forms.py and use it instead of Profile. As the error clearly states, the Profile model does not have a username field. Django actually recommends using the AbstractUser, or the AbstractBaseUser to extend the default User model if you wish to create something like a profile.
On Mon, May 24, 2021 at 9:31 PM Omkar Parab <[email protected]> wrote: > Error is in forms.py file. > > "model = User" not profile. > > Default "User" model comes with username, email filed. > > Why you're creating another email field in the Profile model? > > Just fetch it using {{ user.email }} > > > On Tue, May 25, 2021, 1:38 AM Aritra Ray <[email protected]> wrote: > >> Hi, >> >> I've been facing a problem recently in creating a Django Profile model >> for an E-commerce website. >> Error: FieldError(message) django.core.exceptions.FieldError: Unknown >> field(s) (username) specified for Profile >> Kindly help me out if possible. The screenshots have been attached below >> and the github link for the project has been provided. >> >> Link: https://github.com/First-project-01/Django-ecommerce (Check out >> the 'changes' branch) >> >> Regards, >> Aritra >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAFecadvxBCa6w02%3DZ887%2BnaEdY-R6B9%2BVVFzVW5zYvkt1gA2hg%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAFecadvxBCa6w02%3DZ887%2BnaEdY-R6B9%2BVVFzVW5zYvkt1gA2hg%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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAJY8mfzFT-GqqZ0YvdLKH9gKcTAv%2B1srG9973pXYfA5f_qVA7w%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAJY8mfzFT-GqqZ0YvdLKH9gKcTAv%2B1srG9973pXYfA5f_qVA7w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- KeLLs -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYqDX1dm1Y-T89W9%3DyZQs1bH04eNUj5qcCpwieOSDoY%2BDy9Kg%40mail.gmail.com.

