Error even after following the django documentation

32 views
Skip to first unread message

danbmathew

unread,
Jun 15, 2017, 1:34:00 PM6/15/17
to Django users
Well I'm new to django and my code is just as in the documentation.But got an error while trying to run the codeline q.choice_set.create(choice_text='Not much', votes=0).
This part of the code is almost at the end of the segment named Playing With API.I will also post the error.

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\related_descriptors.py", line 653, in create
    return super(RelatedManager, self.db_manager(db)).create(**kwargs)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\query.py", line 392, in create
    obj = self.model(**kwargs)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 571, in __init__
    raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'choice_text' is an invalid keyword argument for this function


Please help me.

Oladipupo Elegbede

unread,
Jun 15, 2017, 1:42:55 PM6/15/17
to django...@googlegroups.com
TypeError: 'choice_text' is an invalid keyword argument for this function
That above, is where the problem is where the problem is so I am going to guess you need to check your model if you wrote everything correctly.
If I can see what your model looks like, I can probe in.

--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f53b5d7f-baa4-4fa6-91de-e75e4fb97af5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Elegbede Muhammed Oladipupo

skype: dipo.elegbede

danbmathew

unread,
Jun 16, 2017, 8:07:25 AM6/16/17
to Django users
Thanks for the reply.Well i used the same model shown in the documentation.I even cross checked all my codes to verify that anything is out of place.Even then the error appears.


On Thursday, June 15, 2017 at 11:12:55 PM UTC+5:30, Hemhem wrote:
TypeError: 'choice_text' is an invalid keyword argument for this function
That above, is where the problem is where the problem is so I am going to guess you need to check your model if you wrote everything correctly.
If I can see what your model looks like, I can probe in.
On Thu, Jun 15, 2017 at 10:34 AM, danbmathew <danbm...@gmail.com> wrote:
Well I'm new to django and my code is just as in the documentation.But got an error while trying to run the codeline q.choice_set.create(choice_text='Not much', votes=0).
This part of the code is almost at the end of the segment named Playing With API.I will also post the error.

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\related_descriptors.py", line 653, in create
    return super(RelatedManager, self.db_manager(db)).create(**kwargs)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\query.py", line 392, in create
    obj = self.model(**kwargs)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 571, in __init__
    raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'choice_text' is an invalid keyword argument for this function


Please help me.

--
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.

Andréas Kühne

unread,
Jun 16, 2017, 9:11:38 AM6/16/17
to django...@googlegroups.com
Hi,

Could you please include your models.py file? So that we can see the model declarations.

Regards,

Andréas

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages