Hello everyone,
I run into a weird bug in my program.
I have a model called CatalogImage
but at one point of the project (not sure when or what I did to make it happen) I noticed I have duplicates in the database with the same id and values.
for example:
CatalogImage.objects.filter(id=19)
<QuerySet [<CatalogImage: מגף ריינו שחור>, <CatalogImage: מגף ריינו שחור>]>
CatalogImage.objects.get(id=19)
<CatalogImage: מגף ריינו שחור>
CatalogImage.objects.filter(id=19).values()
<QuerySet [{‘id’: 19, ‘title’: ‘מגף ריינו שחור’, ‘description’: ‘* ריינו מגף עבודה\r\n* מגף מקצועי ונוח עשוי מעור איכותי\r\n* אפשרות למגף עם מיגון מלא או ללא מיגון\r\n 02/S3 \r\n* צד אלסטי המאפשר נוחות מירבית לנעילה/ חליצה של הנעל.\r\n* מדרך פנימי ארגונומי ונוח לשעות רבות של עבודה.\r\n* סוליית פוליאוריטן דו שכבתית PU/PU\r\n* אימום אנטומי ורחב במיוחד ,בולם זעזועים מובנה בסוליה.\r\n* SRC-עמידות גבוהה בהחלקה’, ‘image’: ‘שקופית13_optimized_9It5WB6_0nmQKq6_acSUbCz_kuGhiXk_ZXxiRTV_AiwRKrv_IMFkFzk_RSLpsAX_b2JnZ_H6jyZDE.jpg’, ‘image_thumbnail’: ‘image_thumbnail_שקופית13_optimized_9It5WB6_0nmQKq6_acSUbCz_kuGhiXk_ZXxiRTV_AiwRKrv_IMFkF_hUNtq8q.jpg’, ‘big_discount’: True, ‘discount’: ‘/static/assets/catalog/imgs/discount_20.png’}, {‘id’: 19, ‘title’: ‘מגף ריינו שחור’, ‘description’: ‘* ריינו מגף עבודה\r\n* מגף
מקצועי ונוח עשוי מעור איכותי\r\n* אפשרות למגף עם מיגון מלא או ללא מיגון\r\n 02/S3 \r\n* צד אלסטי המאפשר נוחות מירבית לנעילה/ חליצה של הנעל.\r\n* מדרך פנימי ארגונומי ונוח לשעות רבות של עבודה.\r\n* סוליית פוליאוריטן דו שכבתית PU/PU\r\n* אימום אנטומי ורחב במיוחד ,בולם זעזועים מובנה בסוליה.\r\n* SRC-עמידות גבוהה בהחלקה’, ‘image’: ‘שקופית13_optimized_9It5WB6_0nmQKq6_acSUbCz_kuGhiXk_ZXxiRTV_AiwRKrv_IMFkFzk_RSLpsAX_b2JnZ_H6jyZDE.jpg’, ‘image_thumbnail’: ‘image_thumbnail_שקופית13_optimized_9It5WB6_0nmQKq6_acSUbCz_kuGhiXk_ZXxiRTV_AiwRKrv_IMFkF_hUNtq8q.jpg’, ‘big_discount’: True, ‘discount’: ‘/static/assets/catalog/imgs/discount_20.png’}]>
as you can see I have 2 objects with the same id and values, I tried to change the values of one of them from the admin panel and the 2 changed, same about deleting them. how can I get rid of the duplicates and when they created?
Thank you!