Skip to content

Commit

Permalink
Use automatic lists of filter fields
Browse files Browse the repository at this point in the history
Almost all viewsets are updated to automatically include list of filter
fields in this patch. The only exception is `compose/package` API which
is really complicated and a list is not enough for it.

This patch shows previously undocumented `filename` filter for RPMs.
  • Loading branch information
lubomir committed Aug 18, 2015
1 parent 713ce1a commit d233fe8
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 182 deletions.
9 changes: 2 additions & 7 deletions pdc/apps/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
`codename` # optional
`app_label` # optional
`model` # optional
%(FILTERS)s
__URL__:
`/auth/permissions/`
Expand Down Expand Up @@ -302,10 +300,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
`name` # optional
`permission_codename` # optional
`permission_app_label` # optional
`permission_model` # optional
%(FILTERS)s
__Response__:
Expand Down
28 changes: 13 additions & 15 deletions pdc/apps/changeset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,19 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
author # optional
resource # optional
changed_since # optional
changed_until # optional
**NOTE:** `changed_since` and `changed_until` only accept input that
in one of the format listed in `DATETIME_INPUT_FORMATS`:
(
'%%Y-%%m-%%d %%H:%%M:%%S', # '2006-10-25 14:30:59'
'%%Y-%%m-%%d %%H:%%M:%%S.%%f', # '2006-10-25 14:30:59.000200'
'%%Y-%%m-%%d %%H:%%M', # '2006-10-25 14:30'
'%%Y-%%m-%%d', # '2006-10-25'
)
`resource` should be specified in all lower case
%(FILTERS)s
The dates for `changed_since` and `changed_until` should have one these
formats:
Format | Example
---------------------+---------------------------
%%Y-%%m-%%d %%H:%%M:%%S | 2006-10-25 14:30:59
%%Y-%%m-%%d %%H:%%M:%%S.%%f | 2006-10-25 14:30:59.000200
%%Y-%%m-%%d %%H:%%M | 2006-10-25 14:30
%%Y-%%m-%%d | 2006-10-25
Resource names for `resource` should be specified in all lower case.
__Response__:
Expand Down
6 changes: 2 additions & 4 deletions pdc/apps/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
name # optional
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -373,9 +373,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
key_id
name
description(icontains match)
%(FILTERS)s
__Response__:
Expand Down
51 changes: 17 additions & 34 deletions pdc/apps/component/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,9 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
name
dist_git_path
label
email
contact_role # Need to be used together with email to do the filter
upstream_homepage
upstream_scm_type
upstream_scm_url
%(FILTERS)s
The `contact_role` filter must be used together with `email`.
__Response__:
Expand Down Expand Up @@ -360,10 +355,9 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
username
mail_name
email
contact_role # Need to be used together with email to do the filter
%(FILTERS)s
The `contact_role` filter must be used together with `email`.
__Response__:
Expand Down Expand Up @@ -719,16 +713,12 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
name
release
global_component
include_inactive_release # Do not show inactive release component by default
email
contact_role # Need to be used together with email to do the filter
active
bugzilla_component
srpm_name
type # The release component type
%(FILTERS)s
Components for inactive releases are not shown by default. You can
change this with `include_inactive_release` set to any non-empty value.
The `contact_role` filter must be used together with `email`.
__Response__:
Expand Down Expand Up @@ -1160,7 +1150,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
contact_role
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1384,8 +1374,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
name
parent_component
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1692,7 +1681,7 @@ def list(self, request, *args, **kwargs):
__Query params__:
* `name`
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1814,9 +1803,7 @@ def list(self, request, *args, **kwargs):
__Query params__:
* `group_type`
* `release`
* `release_component`
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1958,11 +1945,7 @@ def list(self, request, *args, **kwargs):
__Query params__:
* `type` relationship type
* `from_component_release` release_id of 'from' release component's release
* `from_component_name` name of 'from' release component's release
* `to_component_release` release_id of 'to' release component's release
* `to_component_name` name of 'to' release component's release
%(FILTERS)s
__Response__:
Expand Down
41 changes: 6 additions & 35 deletions pdc/apps/compose/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,21 +478,7 @@ def list(self, *args, **kwargs):
__Query params__:
* `compose_date`
* `compose_id`
* `compose_label`
* `compose_respin`
* `compose_type`
* `deleted`
* `release`
* `rpm_arch`
* `rpm_name`
* `rpm_nvr`
* `rpm_nvra`
* `rpm_release`
* `rpm_version`
* `srpm_name`
* `acceptance_testing`
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -905,13 +891,7 @@ def list(self, *args, **kwargs):
__Query params__:
* release
* variant
* arch
* srpm_name
* rpm_name
* rpm_arch
* comment (substring match on this field)
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1069,9 +1049,9 @@ def list(self, request):
__Query params__:
The nvr is always required.
The `nvr` is always required.
* nvr
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1213,12 +1193,7 @@ def list(self, request, **kwargs):
__Query params__:
The RPM name and release id are always required.
* `included_compose_type`: optional
* `excluded_compose_type`: optional
* `latest`: optional
* `to_dict`: optional
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -1272,11 +1247,7 @@ def list(self, request, **kwargs):
__Query params__:
The RPM name and release id are always required.
* `included_compose_type`: optional
* `excluded_compose_type`: optional
* `to_dict`: optional
%(FILTERS)s
__Response__:
Expand Down
13 changes: 4 additions & 9 deletions pdc/apps/contact/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
username # optional
email # optional
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -244,8 +243,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
mail_name # optional
email # optional
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -432,7 +430,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
name # optional
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -644,10 +642,7 @@ def list(self, request, *args, **kwargs):
__QUERY Params__:
contact_role # optional
username # optional
mail_name # optional
email # optional
%(FILTERS)s
**NOTE:** Support listed query params. The logic is:
Expand Down
45 changes: 9 additions & 36 deletions pdc/apps/package/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,7 @@ def list(self, *args, **kwargs):
__Query params__:
* `name`
* `version`
* `epoch`
* `release`
* `arch`
* `srpm_name`
* `srpm_nevra`
* `compose`
* `linked_release`
%(FILTERS)s
__Response__:
Expand Down Expand Up @@ -201,22 +193,10 @@ def list(self, request):
__Query params__:
* arch
* bootable (possible values `True` and `False`)
* disc_count
* disc_number
* file_name
* image_format
* image_type
* implant_md5
* md5
* mtime
* sha1
* sha256
* size
* volume_id
* compose - only include images included in given release, value for
this filter should be compose ID
%(FILTERS)s
The `compose` filter allows filtering images connected to a particular
compose. The value should be compose ID.
If the same filter is specified multiple times, it will do a OR query.
Expand Down Expand Up @@ -341,17 +321,10 @@ def list(self, request, *args, **kwargs):
__Query params__:
* component_name: srpm_name or release_component_name if release_component srpm mapping exists
* rpm_version : rpm nvr's version
* rpm_release : rpm nvr's release
* release_id : product release id
* image_id
* image_format
* md5
* archive_build_nvr
* archive_name
* archive_size
* archive_md5
%(FILTERS)s
The value of `component_name` should be either SRPM name or release
component name if release component to srpm mapping exists.
__Response__:
Expand Down

0 comments on commit d233fe8

Please sign in to comment.