let's cut down on non-relevant code and keep try/excepts small
```python
obj = Invoice(...)
try:
    obj.save()
    result = model_to_raw_dict(obj)
    code = 200
except:
    result = {'reason': e.message}
    code = 500
return HttpResponse(content=json.dumps(result), status=code)