mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 03:49:10 +02:00
Enhance filtering comparisons
Allow searching on: * Any "available" status (i.e. other than "Unknown" or "Not available") * Whether the package has patches or not * What the covering layer is (assuming there is one). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
ca9c4ffa66
commit
ea77e75ddd
|
@ -215,15 +215,22 @@ BulkChangeEditFormSet = modelformset_factory(RecipeChange, form=BulkChangeEditFo
|
|||
|
||||
|
||||
class ClassicRecipeSearchForm(forms.Form):
|
||||
COVER_STATUS_CHOICES = [('','(any)'), ('!','(unknown / not available)')] + ClassicRecipe.COVER_STATUS_CHOICES
|
||||
COVER_STATUS_CHOICES = [('','(any)'), ('!','(unknown / not available)'), ('#','(available)')] + ClassicRecipe.COVER_STATUS_CHOICES
|
||||
VERIFIED_CHOICES = [
|
||||
('', '(any)'),
|
||||
('1', 'Verified'),
|
||||
('0', 'Unverified'),
|
||||
]
|
||||
PATCH_CHOICES = [
|
||||
('', '(any)'),
|
||||
('1', 'Has patches'),
|
||||
('0', 'No patches'),
|
||||
]
|
||||
|
||||
q = forms.CharField(label='Keyword', max_length=255, required=False)
|
||||
category = forms.CharField(max_length=255, required=False)
|
||||
oe_layer = forms.ModelChoiceField(label='OE Layer', queryset=LayerItem.objects.filter(classic=False).filter(status__in=['P', 'X']).order_by('name'), empty_label="(any)", required=False)
|
||||
has_patches = forms.ChoiceField(label='Patches', choices=PATCH_CHOICES, required=False)
|
||||
cover_status = forms.ChoiceField(label='Status', choices=COVER_STATUS_CHOICES, required=False)
|
||||
cover_verified = forms.ChoiceField(label='Verified', choices=VERIFIED_CHOICES, required=False)
|
||||
|
||||
|
|
|
@ -927,10 +927,14 @@ class ClassicRecipeSearchView(RecipeSearchView):
|
|||
cover_status = self.request.GET.get('cover_status', None)
|
||||
cover_verified = self.request.GET.get('cover_verified', None)
|
||||
category = self.request.GET.get('category', None)
|
||||
oe_layer = self.request.GET.get('oe_layer', None)
|
||||
has_patches = self.request.GET.get('has_patches', '')
|
||||
init_qs = ClassicRecipe.objects.filter(layerbranch__branch__name=self.kwargs['branch']).filter(deleted=False)
|
||||
if cover_status:
|
||||
if cover_status == '!':
|
||||
init_qs = init_qs.filter(cover_status__in=['U', 'N', 'S'])
|
||||
elif cover_status == '#':
|
||||
init_qs = init_qs.exclude(cover_status__in=['U', 'N', 'S'])
|
||||
else:
|
||||
init_qs = init_qs.filter(cover_status=cover_status)
|
||||
if cover_verified:
|
||||
|
@ -940,6 +944,13 @@ class ClassicRecipeSearchView(RecipeSearchView):
|
|||
init_qs = init_qs.filter(classic_category='')
|
||||
else:
|
||||
init_qs = init_qs.filter(classic_category__icontains=category)
|
||||
if oe_layer:
|
||||
init_qs = init_qs.filter(cover_layerbranch__layer=oe_layer)
|
||||
if has_patches.strip():
|
||||
if has_patches == '1':
|
||||
init_qs = init_qs.filter(patch__isnull=False).distinct()
|
||||
else:
|
||||
init_qs = init_qs.filter(patch__isnull=True)
|
||||
if query_string.strip():
|
||||
order_by = (Lower('pn'), 'layerbranch__layer')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user