Skip to content

Instantly share code, notes, and snippets.

@BuildWithLal
Last active June 12, 2018 08:47
Show Gist options
  • Save BuildWithLal/9c6ef538e2b6bdadc4507398c7324419 to your computer and use it in GitHub Desktop.
Save BuildWithLal/9c6ef538e2b6bdadc4507398c7324419 to your computer and use it in GitHub Desktop.
# image create view
if form.is_valid():
images = Image.objects.order_by('-_id').all()
if len(images)>0:
# get latest image scene number
scene_number = Images.first().scene_number + 1
else:
# creating first image so set scene_number =1
scene_number = 1
image = form.save()
image.scene_number = scene_number
# set image.image
# set image.video
# save image finally
image.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment