mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 13:14:46 +02:00
layerindex: Allow staff to set Yocto compatibility
Fixes [YOCTO #15738] Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
This commit is contained in:
parent
c4f18608a1
commit
be1567acc3
|
@ -24,7 +24,8 @@ import settings
|
|||
from layerindex.models import (Branch, ClassicRecipe,
|
||||
LayerBranch, LayerItem, LayerMaintainer,
|
||||
LayerNote, RecipeChange, RecipeChangeset,
|
||||
SecurityQuestion, UserProfile, PatchDisposition)
|
||||
SecurityQuestion, UserProfile, PatchDisposition,
|
||||
YPCompatibleVersion)
|
||||
|
||||
|
||||
class StyledForm(forms.Form):
|
||||
|
@ -77,6 +78,7 @@ class EditLayerForm(StyledModelForm):
|
|||
# Additional form fields
|
||||
vcs_subdir = forms.CharField(label='Repository subdirectory', max_length=60, required=False, help_text='Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)')
|
||||
actual_branch = forms.CharField(label='Actual branch', max_length=80, required=False, help_text='Name of the actual branch in the repository matching the core branch (e.g. the development branch is "master" by default)')
|
||||
yp_compatible_version = forms.ModelChoiceField(label='Yocto Project Compatible version', queryset=YPCompatibleVersion.objects.all(), required=False)
|
||||
deps = forms.ModelMultipleChoiceField(label='Other layers this layer depends upon', queryset=LayerItem.objects.filter(comparison=False), required=False)
|
||||
captcha = CaptchaField(label='Verification', help_text='Please enter the letters displayed for verification purposes', error_messages={'invalid':'Incorrect entry, please try again'})
|
||||
|
||||
|
@ -109,6 +111,9 @@ class EditLayerForm(StyledModelForm):
|
|||
self.fields = new_fields
|
||||
self.fields['vcs_subdir'].initial = layerbranch.vcs_subdir
|
||||
self.fields['actual_branch'].initial = layerbranch.actual_branch
|
||||
self.fields['yp_compatible_version'].initial = layerbranch.yp_compatible_version
|
||||
if not user.is_staff:
|
||||
self.fields['yp_compatible_version'].widget.attrs['disabled'] = True
|
||||
self.was_saved = False
|
||||
self.allow_base_type = allow_base_type
|
||||
|
||||
|
|
|
@ -204,6 +204,11 @@ def edit_layer_view(request, template_name, branch='master', slug=None):
|
|||
reset_last_rev = True
|
||||
layerbranch.save()
|
||||
maintainerformset.save()
|
||||
if (request.user.is_authenticated and request.user.is_staff):
|
||||
new_yp_compatible = form.cleaned_data['yp_compatible_version']
|
||||
if layerbranch.yp_compatible_version != new_yp_compatible:
|
||||
layerbranch.yp_compatible_version = new_yp_compatible
|
||||
layerbranch.save()
|
||||
if slug:
|
||||
new_deps = form.cleaned_data['deps']
|
||||
existing_deps = [deprec.dependency for deprec in layerbranch.dependencies_set.all()]
|
||||
|
|
Loading…
Reference in New Issue
Block a user