admin: allow changing branch on layerbranch records

Sometimes layers get created on master and then the master branch is
removed in favour of a release branch. In that case it can be useful to
switch the existing layerbranch record rather than having to create a
blank one and copy everything over.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-10-01 14:07:25 +13:00
parent d328e392d2
commit ed7025813e

View File

@ -66,7 +66,7 @@ class LayerBranchAdmin(CompareVersionAdmin):
def get_readonly_fields(self, request, obj=None): def get_readonly_fields(self, request, obj=None):
readonly_fields = self.readonly_fields readonly_fields = self.readonly_fields
if obj: if obj:
readonly_fields += ('layer', 'branch') readonly_fields += ('layer',)
if not request.user.has_perm('layerindex.set_yp_compatibility'): if not request.user.has_perm('layerindex.set_yp_compatibility'):
readonly_fields += ('yp_compatible_version',) readonly_fields += ('yp_compatible_version',)
return readonly_fields return readonly_fields