|
|
@@ -507,12 +507,12 @@ class AdminView(LoginRequiredMixin, generic.ListView):
|
|
|
# print(elemk + " - " + public[elemk] )
|
|
|
keys = elemk.split(".")
|
|
|
current_product = Product.objects.get(pk=keys[1])
|
|
|
- if public[elemk] == 'true':
|
|
|
+ if public[elemk] == 'true' and current_product.public == False :
|
|
|
current_product.public = True
|
|
|
current_product.save()
|
|
|
- else:
|
|
|
- current_product.public = False
|
|
|
- current_product.save()
|
|
|
+ # else:
|
|
|
+ # current_product.public = False
|
|
|
+ # current_product.save()
|
|
|
|
|
|
edit = {k: v for k, v in context.items() if k.startswith('product_e')}
|
|
|
# print (edit)
|
|
|
@@ -520,12 +520,12 @@ class AdminView(LoginRequiredMixin, generic.ListView):
|
|
|
# print(elemk + " - " + edit[elemk] )
|
|
|
keys = elemk.split(".")
|
|
|
current_product = Product.objects.get(pk=keys[1])
|
|
|
- if edit[elemk] == 'true':
|
|
|
+ if edit[elemk] == 'true' and current_product.edit == False :
|
|
|
current_product.edit = True
|
|
|
current_product.save()
|
|
|
- else:
|
|
|
- current_product.edit = False
|
|
|
- current_product.save()
|
|
|
+ # else:
|
|
|
+ # current_product.edit = False
|
|
|
+ # current_product.save()
|
|
|
|
|
|
return HttpResponseRedirect('')
|
|
|
|