edit view should be a bit faster
This commit is contained in:
@@ -2358,7 +2358,7 @@ def instroke_chart(request,id=0,metric=''):
|
||||
height = 600
|
||||
|
||||
imgs = GraphImage.objects.filter(workout=w)
|
||||
if len(imgs) < 7:
|
||||
if imgs.count() < 7:
|
||||
i = GraphImage(workout=w,
|
||||
creationdatetime=timezone.now(),
|
||||
filename=fullpathimagename,
|
||||
@@ -3505,16 +3505,8 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
dataprep.runcpupdate(row.user,type=row.workouttype)
|
||||
|
||||
messages.info(request,successmessage)
|
||||
url = reverse('workout_edit_view',
|
||||
kwargs = {
|
||||
'id':encoder.encode_hex(row.id),
|
||||
})
|
||||
response = HttpResponseRedirect(url)
|
||||
|
||||
#else: # form not POSTed
|
||||
form = WorkoutForm(instance=row)
|
||||
|
||||
row = get_workout(id)
|
||||
else:
|
||||
form = WorkoutForm(instance=row)
|
||||
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
for i in g:
|
||||
@@ -3706,7 +3698,7 @@ def workout_uploadimage_view(request,id):
|
||||
images = GraphImage.objects.filter(workout=w)
|
||||
|
||||
|
||||
if len(images) >= 6:
|
||||
if images.count() >= 6:
|
||||
message = "You have reached the maximum number of static images for this workout"
|
||||
messages.error(request,message)
|
||||
url = reverse(r.defaultlandingpage,
|
||||
|
||||
Reference in New Issue
Block a user