update get_frame command for new django version, fixes #3155

This commit is contained in:
j 2018-07-29 18:56:01 +01:00
parent fde36c3ae0
commit 13fcb20796

View file

@ -11,13 +11,18 @@ from ... import models
class Command(BaseCommand): class Command(BaseCommand):
help = 'extract frame and print path' help = 'extract frame and print path'
args = '<id> <height> <position>'
def handle(self, id, height, position, **options): def add_arguments(self, parser):
parser.add_argument('args', metavar='args', type=str, nargs='*', help='<id> <height> <position>')
def handle(self, id, height, position, **kwargs):
position = float(position) position = float(position)
height = int(height) height = int(height)
with transaction.atomic(): with transaction.atomic():
i = models.Item.objects.get(public_id=id) try:
path = i.frame(position, height) i = models.Item.objects.get(public_id=id)
path = i.frame(position, height)
except models.Item.DoesNotExist:
path = None
if path: if path:
print(path) print(path)