Private
Public Access
1
0

restricted allowable static images to 6

This commit is contained in:
Sander Roosendaal
2018-01-23 12:09:41 +01:00
parent 585b48cdf6
commit 983b3be86c
3 changed files with 38 additions and 25 deletions

View File

@@ -280,11 +280,16 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
width = 1200
height = 600
i = GraphImage(workout=w,
creationdatetime=timezone.now(),
filename=fullpathimagename,
width=width,height=height)
i.save()
imgs = GraphImage.objects.filter(workout=w)
if len(imgs) < 7:
i = GraphImage(workout=w,
creationdatetime=timezone.now(),
filename=fullpathimagename,
width=width,height=height)
i.save()
else:
return 0,'You have reached the maximum number of static images for this workout. Delete an image first'
return i.id,job.id