Make an other constraints pk and your issue is solved django by default
make a pk as id

On Sat, 24 Sept 2022, 10:46 Salima Begum, <salim...@rohteksolutions.com>
wrote:

> Hi all,
>
> When I am posting data in the server here we have an issue where the
> primary key already exists. For example, today I posted some data . I have
> the same issue. I solved the issue by deleting data from that particular
> table and then I am able to post data. Next day if I try to post data I am
> having the same issue with the primary key already exists. Why this is
> happening I am not able to understand.  On the server I am getting this
> issue where as in local I don't have any issue.
> Please help me to understand why I am having this issue.
> ```
> django.db.utils.IntegrityError: duplicate key value violates unique
> constraint "trades_trade_table_pkey"
> DETAIL: Key (id)=(2) already exists
> ```
> Thank you
> ~Salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bmxvY2f3caZbqvNG3ZaghriShCQV1pouvvOWmgx-wpgbA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6bmxvY2f3caZbqvNG3ZaghriShCQV1pouvvOWmgx-wpgbA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACbcXAUFiToDmbDcBD22tvbpS9W%3D8n%2BXSkdF3MYta_iH%2BgfYgA%40mail.gmail.com.

Reply via email to