Contact() got an unexpected keyword argument 'fname'

706 views
Skip to first unread message

R D Saini

unread,
Jun 11, 2020, 1:02:49 PM6/11/20
to Django users

Screenshot (39).png

please my help me this error solved

oba stephen

unread,
Jun 11, 2020, 1:32:10 PM6/11/20
to django...@googlegroups.com
Can you share your Views.py file?

On Thu, Jun 11, 2020 at 6:02 PM R D Saini <rdsai...@gmail.com> wrote:

Screenshot (39).png

please my help me this error solved

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/78356741-5d38-448f-9f9b-c7f1f13d35c3o%40googlegroups.com.

maninder singh Kumar

unread,
Jun 11, 2020, 1:36:37 PM6/11/20
to django...@googlegroups.com
It means precisely what it says, you are passing a keyword argument to your contact function in views.py, maybe it needs to be a positional argument.
regards ... willy

On Thu, Jun 11, 2020 at 10:34 PM R D Saini <rdsai...@gmail.com> wrote:

Screenshot (39).png

please my help me this error solved

--

R D Saini

unread,
Jun 12, 2020, 1:01:46 AM6/12/20
to django...@googlegroups.com
Screenshot (40).png
Screenshot (41).png

oba stephen

unread,
Jun 12, 2020, 1:53:13 AM6/12/20
to django...@googlegroups.com
Try taking out the second argument in request.POST.get(). That should do it. You are passing two variables to fname, when it requires just one.

On Thu, Jun 11, 2020 at 6:02 PM R D Saini <rdsai...@gmail.com> wrote:

Screenshot (39).png

please my help me this error solved

--

Kasper Laudrup

unread,
Jun 12, 2020, 4:44:20 AM6/12/20
to django...@googlegroups.com
Hi RD.

I can't remember all the scoping rules of Python, but you most likely
try construct an instance of Contact from your views, not your model
(ie. the same class where your call is failing).

Consider renaming your Contact view class to ContactView or change your
import from model and use the fully qualified name, ie. models.Contact.

Hopefully that should solve it, and would IMO improve readability a bit
anyway.

Kind regards,

Kasper Laudrup

José Zuñiga

unread,
Jun 12, 2020, 8:22:51 AM6/12/20
to Django users
Try using the call of model Contact like this:

contact = Contact.objects.create(vars...)
in vars use the same inputs.
Reply all
Reply to author
Forward
0 new messages