From 488b5431de095a3a14a76e0dd7d2e989dae7b8d0 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 24 Mar 2013 12:25:09 +0000 Subject: [PATCH] avoid creating Clip multiple times --- pandora/clip/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index 47a14d86..456b5c8d 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -92,7 +92,7 @@ class MetaClip: end = float('%0.03f' % end) qs = cls.objects.filter(item=item, start=start, end=end) if qs.count() == 0: - clip = Clip(item=item, start=start, end=end) + clip, created = cls.objects.get_or_create(item=item, start=start, end=end) clip.save() created = True else: