1👍
✅
Just use
couponCode = request.POST['code']
instead of
couponCode = str(request.POST.get("code"))
1👍
Remove the str()
part. Leave it only as:
couponCode = request.POST.get("code")
,
then you could do:
Coupon.objects.filter(code=couponCode)
Hope this helps.
👤Rigo
- [Answered ]-My api call doesnot work in javascript but works fine with in postman and browser
- [Answered ]-How can I make a specific login for specific group with Django's `authenticate()`?
- [Answered ]-Django Rest Framework – use serializers to send json with requests library
- [Answered ]-Django-Fluent-Comments – NoReverseMatch at /rohit/post/new/
- [Answered ]-Page not found is showing (django)
Source:stackexchange.com