# ErrorDict' object has no attribute 'status\_code

**URL:** <https://forum.djangoproject.com/t/errordict-object-has-no-attribute-status-code/5670>\
**Category:** Using Django\
**Created:** [December 12, 2020, 2:19pm UTC](https://forum.djangoproject.com/t/errordict-object-has-no-attribute-status-code/5670 "2020-12-12T14:19:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lyounessi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/lyounessi/32/2402_2.png) [@Lyounessi](https://forum.djangoproject.com/u/Lyounessi)\
**Post date:** [December 12, 2020, 2:19pm UTC](https://forum.djangoproject.com/t/errordict-object-has-no-attribute-status-code/5670/1 "2020-12-12T14:19:59Z")

</div>

Hello World!

I got this error from when I submit a post method, and here is my post code.  
I can not have an exact traceback to know the error well,  
any help please

def post(self, request, \*args, \*\*kwargs):  
form = self.form\_class(request.POST)  
context = {  
‘form’: form,  
}  
if form.is\_valid():  
print(‘yeeeeeeees’)  
clt = form.save(commit=False)  
clt.creator = request.user  
clt.number = autoNumInvoice()  
clt.save()  
return render(‘clients:home’)  
else:  
return form.errors  
return render(request, self.template\_name, context=context)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 12, 2020, 6:11pm UTC](https://forum.djangoproject.com/t/errordict-object-has-no-attribute-status-code/5670/2 "2020-12-12T18:11:21Z")

</div>

> [@Lyounessi](#):
>
> return form.errors

A view must return an HTTP response, not the errors dict from your form.

Also, when posting code, please enclose the code between lines consisting of only three backtick - ` characters. This means you’ll have one line of ```, followed by your lines of code, followed by another line of ```. This allows your code to maintain its formatting, which is extremely important when working with Python!

---

<div class="post-metadata">

**Author:** ![Lyounessi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/lyounessi/32/2402_2.png) [@Lyounessi](https://forum.djangoproject.com/u/Lyounessi)\
**Post date:** [December 12, 2020, 10:51pm UTC](https://forum.djangoproject.com/t/errordict-object-has-no-attribute-status-code/5670/3 "2020-12-12T22:51:27Z")

</div>

thank you Ken, i want just know why my form is not valid, is there any way to know the exact traceback

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 13, 2020, 1:33am UTC](https://forum.djangoproject.com/t/errordict-object-has-no-attribute-status-code/5670/4 "2020-12-13T01:33:54Z")

</div>

Review the [Working with forms](https://docs.djangoproject.com/en/3.1/topics/forms/) docs, particularly the parts on [Rendering form error messages](https://docs.djangoproject.com/en/3.1/topics/forms/#rendering-form-error-messages).
