changes as suggested by @dianakhuang and @jbau

@chrisndodge Kindly review the changeset.

Thanks
Same here: put the error handling code closer to the spot where the error could be raised. You can also return early on errors, which reduces the indentation levels and makes the code more readable.
```python
coupon_id = request.REQUEST.get('coupon_id', None)
if not coupon_id:
    return HttpResponseNotFound()
try:
    coupon = Coupons.objects.get(pk=coupon_id)
except ObjectDoesNotExist:
    return HttpResponseNotFound()
filtered_coupons = Coupons.objects.filter(~Q(id=coupon_id), code=code, is_active=True)
if filtered_coupons:
    return HttpResponseNotFound()
# do other stuff
coupon.save()
return HttpResponse("no errors")
```