Discussion:
get_or_delete leading to duplicate creation
Ankit Khandewal
2018-11-27 08:00:47 UTC
Permalink
Hello,

I am using get_or_create method in my project and this is leading to
creating duplicate for objects, there created_at time difference is in
milliseconds, please report this issue to fix.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andréas Kühne
2018-11-27 12:57:02 UTC
Permalink
Hi Ankit,

First - this is not the Django developers forum - it's a forum for getting
help from other users :-)
Second - I don't think this is an error in the underlying framework.
get_or_create is used by many people (I use it in several places -
especially in tests) - I would recommend that you check through your code
to see what is triggering the get_or_create calls twice first. The problem
is more likely to be something in the code that you have.

If you want help, feel free to post the problematic code here, and I am
sure that the community will help!

Regards,

Andréas


Den tis 27 nov. 2018 kl 13:37 skrev Ankit Khandewal <
Post by Ankit Khandewal
Hello,
I am using get_or_create method in my project and this is leading to
creating duplicate for objects, there created_at time difference is in
milliseconds, please report this issue to fix.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCf-T36KbLGg_1xMkD%2BWfmz0-U2NkDFM2SHmvQ8rf7ag3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Joel Mathew
2018-11-27 12:57:26 UTC
Permalink
You're talking as if this is a bug. If your records are being duplicated,
the problem is your code. It's not unto django to gauge what you need to do
in the database. Be explicit and update the records if you want updation.
Sincerely yours,

Joel G Mathew
Post by Ankit Khandewal
Hello,
I am using get_or_create method in my project and this is leading to
creating duplicate for objects, there created_at time difference is in
milliseconds, please report this issue to fix.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw_9FC%3D%3DpsxcUTAZGaE%3DaNrRtpNa758VBjbtX3hN7J8HqZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Matthew Pava
2018-11-27 15:06:31 UTC
Permalink
Avoid using the created_at time in your get_or_create call.

From: django-***@googlegroups.com [mailto:django-***@googlegroups.com] On Behalf Of Ankit Khandewal
Sent: Tuesday, November 27, 2018 2:01 AM
To: Django users
Subject: get_or_delete leading to duplicate creation

Hello,

I am using get_or_create method in my project and this is leading to creating duplicate for objects, there created_at time difference is in milliseconds, please report this issue to fix.
--
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+***@googlegroups.com<mailto:django-users+***@googlegroups.com>.
To post to this group, send email to django-***@googlegroups.com<mailto:django-***@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com<https://groups.google.com/d/msgid/django-users/4c8f9ca3-1379-49de-b37e-1978fc83444b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/769c6e8ad3e74b6e96238ce7f1dd7b3d%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...