# Unique Constraints Failed

**URL:** <https://forum.djangoproject.com/t/unique-constraints-failed/16796>\
**Category:** ORM\
**Created:** [November 3, 2022, 2:07pm UTC](https://forum.djangoproject.com/t/unique-constraints-failed/16796 "2022-11-03T14:07:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wilfred1213](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/wilfred1213/32/7438_2.png) [@Wilfred1213](https://forum.djangoproject.com/u/Wilfred1213)\
**Post date:** [November 3, 2022, 2:07pm UTC](https://forum.djangoproject.com/t/unique-constraints-failed/16796/1 "2022-11-03T14:07:41Z")

</div>

This error occurred when same user try to save something in database. I realised this error while I was working with modelform. Is there any solution to this challenge? I try to save directly from database the error return that a user with the same username already already exists

---

<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:** [November 3, 2022, 2:14pm UTC](https://forum.djangoproject.com/t/unique-constraints-failed/16796/2 "2022-11-03T14:14:57Z")

</div>

> [@Wilfred1213](#):
>
> Is there any solution to this challenge?

Yes, but we’ll need more detailed and specific information.

We’ll need to see the code for your view and may also need to see your model.

When posting code here, do not post images. Copy/paste the code directly into your post, between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This will force the forum software to keep your code properly formatted, which is critical with Python.

---

<div class="post-metadata">

**Author:** ![Wilfred1213](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/wilfred1213/32/7438_2.png) [@Wilfred1213](https://forum.djangoproject.com/u/Wilfred1213)\
**Post date:** [November 3, 2022, 8:12pm UTC](https://forum.djangoproject.com/t/unique-constraints-failed/16796/3 "2022-11-03T20:12:54Z")

</div>

Ok thank. I will post the codes
