wrap get_frame into transaction to avoid postgres error

This commit is contained in:
j 2014-11-16 11:23:02 +00:00
parent f0ea9c17a1
commit 573f034df2
1 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db import transaction
settings.RELOAD_CONFIG = False
import app.monkey_patch
@ -14,7 +15,8 @@ class Command(BaseCommand):
def handle(self, id, height, position, **options):
position = float(position)
height = int(height)
i = models.Item.objects.get(public_id=id)
path = i.frame(position, height)
with transaction.commit_on_success():
i = models.Item.objects.get(public_id=id)
path = i.frame(position, height)
if path:
print path