Positional argument after keyword argument ?
Closed this issue · 2 comments
send_db_mail( slug='welcome', recipient='user1@example.com', { 'username': request.user.username, 'full_name': request.user.get_full_name(), 'signup_date': request.user.date_joined }, MyModel.objects.get(pk=1) )
The above code should be replaced by below one:
send_db_mail({ 'username': request.user.username, 'full_name': request.user.get_full_name(), 'signup_date': request.user.date_joined }, slug='welcome', recipient='user1@example.com',, MyModel.objects.get(pk=1) )
But gives the error like
db_sender() got multiple values for keyword argument 'slug'
I am using 'os x el capitan
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/api_v1/gateways/p/codrequest/
Django Version: 1.8.2
Python Version: 2.7.10
Traceback:
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/viewsets.py" in view
return view_func(_args, *_kwargs)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
return self.dispatch(request, _args, *_kwargs)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
response = self.handle_exception(exc)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/mixins.py" in create
response = handler(request, _args, *_kwargs)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/mixins.py" in perform_create
self.perform_create(serializer)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/serializers.py" in save
serializer.save()
-
File "/Users/sagar/p/p_api/api_v1/serializers.py" in create
self.instance = self.create(validated_data)
-
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/dbmail/init.py" in send_db_mail
slug='welcome2', recipient='sagarg.1988@gmail.com, sagar.gavli@p.co.in')
-
return db_sender(_args, *_kwargs)
Exception Type: TypeError at /api_v1/gateways/p/codrequest/
Exception Value: db_sender() got multiple values for keyword argument 'slug'
I have given the stack trace above.
Please let me know the solution
Thanks , Got the issue