Monday, August 31, 2015

Re: I have error like Type Error save() takes at least 2 arguments (1 given) in Django project.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJV5DX2AAoJEH2EY3tf/UcFgrwQAIPyB6nkKVJwDbavGScggG5/
LQglF0i2taAQWPqg9l3HEN0/cVKOcKb10KG+SjsKurgcy9LIGG9O5cZIE1OjEftJ
shqjRS5DeCYDB4exhMPVtoBkf2v9UW3vb4OGWGXGEP8HOFTXibR0kNhplsKGTjrd
Aj2uKnz81lpMlwDR/94B/yNDWJ38wf5lDBwpsOpEZ5tWv9YEcjefRgfQk8simlGI
d2eQL9qGZkIEbc50Pa1WBUFnWZWKX0NBrjUHRt/sJ4H5p9Ylnxi+8JzemGevg8mx
ph4MelCRJdZNnGjN+BA8rIQAjmy2XVsAcvZr1cV1WVtXkuXCwr9qBZqOpDKv2jjO
zUljIKjj72lmc34SY42yj0JdV5Pr6VnM8vf6E1yNkiHyr9Va1emQ5uq2atTJ5DTn
Sv5PrGHD7ght82CbSzewVVywbuHVXXg5q70nIFFVfxg2k5mXTk32eMuRxKng0UjH
uKFOKgo+kl2aoJ5lxCIjhso2JuY2BrgidAB+WICyZb5kNWb9gquq9LjM2U2MPW0j
pviLs82S5uk+RlRX7pcRwqIbs2QNMLifYKBmj2A7NjqIxk9aincAYwCU9JYDXuZ4
deqF6rUxt9mXEnTdG0X9jyA7tHEpbRyXOIbZRmw+8amGND2+8cDKIjn8Tn1en0LD
CuJ1V77EoUbtQp48ndA7
=81ua
-----END PGP SIGNATURE-----
On 31/08/15 12:10, Remaze Vs wrote:
> def save(self,request,*args,**kwargs):

You defined save to take a second positional argument, so it's no wonder
it crashes if you call .save()
If you need the request in the save method you have to pass it,
otherwise remove the request parameter.

See docs for .save() overwrite:
https://docs.djangoproject.com/en/1.8/ref/models/instances/#django.db.models.Model.save

regards,
Florian

--
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-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/55E435F1.4%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment