forked from enviPath/enviPy
refactor of license django model #119
This commit is contained in:
@ -1047,9 +1047,7 @@ def package(request, package_uuid):
|
||||
write = request.POST.get("write") == "on"
|
||||
owner = request.POST.get("owner") == "on"
|
||||
|
||||
license = request.POST.get("license")
|
||||
license_link = request.POST.get("license-link")
|
||||
license_image_link = request.POST.get("license-image-link")
|
||||
cc_string = request.POST.get("license")
|
||||
|
||||
if new_package_name:
|
||||
current_package.name = new_package_name
|
||||
@ -1077,24 +1075,13 @@ def package(request, package_uuid):
|
||||
|
||||
PackageManager.update_permissions(current_user, current_package, grantee, max_perm)
|
||||
return redirect(current_package.url)
|
||||
elif license is not None:
|
||||
if license == "no-license":
|
||||
if current_package.license is not None:
|
||||
current_package.license.delete()
|
||||
|
||||
elif cc_string is not None:
|
||||
if cc_string == "no-license":
|
||||
current_package.license = None
|
||||
current_package.save()
|
||||
return redirect(current_package.url)
|
||||
else:
|
||||
if current_package.license is not None:
|
||||
current_package.license.delete()
|
||||
|
||||
license = License()
|
||||
license.link = license_link
|
||||
license.image_link = license_image_link
|
||||
license.save()
|
||||
|
||||
current_package.license = license
|
||||
current_package.license = License.objects.get(cc_string=cc_string)
|
||||
current_package.save()
|
||||
|
||||
return redirect(current_package.url)
|
||||
|
||||
Reference in New Issue
Block a user