diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-05-19 16:14:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:47 +0100 |
commit | afe06e313eac61f598f65e622ceb5951a9fabc9a (patch) | |
tree | 02e37805b7b10a30c77fc3c82987bf435b221423 /bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |
parent | 94aa0d5408f71a2e9fd48fd2c0e283acfc9ac2a2 (diff) | |
download | poky-afe06e313eac61f598f65e622ceb5951a9fabc9a.tar.gz |
bitbake: toaster: move project data typeahead to the REST API
This patch enables JSON requests on the project REST endpoint,
and replaces the universal queries "xhr_datatypeahead" with the
`project` type to the REST project endpoint.
The patch adds a decorator that takes a context returned by a view
and either renders the template specified as the decorator argument,
or converts the context to JSON.
Normal "search", "filter" and "order" options for view work as normal
on the JSON API format. To enable the JSON return, set the "format"
GET parameter to "json".
In order to demonstrate the functionality, the "New build" button
is switched from using the xhr_datatypeahead to the project
REST API with JSON formatting. Additionally, the XHR APIs that
perform actions with the project id passed as parameter are removed,
and the needed URLs are populated from the project JSON API returns after
the project has been selected.
(Bitbake rev: 15a2274eba13d19b864f337057d61c75ff7849cc)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 8028ae0022..e79a4e5848 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |||
@@ -51,11 +51,11 @@ def get_tasks(queryset): | |||
51 | 51 | ||
52 | 52 | ||
53 | @register.filter(name = "json") | 53 | @register.filter(name = "json") |
54 | def json(value): | 54 | def json(value, default = None): |
55 | # JSON spec says that "\/" is functionally identical to "/" to allow for HTML-tag embedding in JSON strings | 55 | # JSON spec says that "\/" is functionally identical to "/" to allow for HTML-tag embedding in JSON strings |
56 | # unfortunately, I can't find any option in the json module to turn on forward-slash escaping, so we do | 56 | # unfortunately, I can't find any option in the json module to turn on forward-slash escaping, so we do |
57 | # it manually here | 57 | # it manually here |
58 | return mark_safe(JsonLib.dumps(value, ensure_ascii=False).replace('</', '<\\/')) | 58 | return mark_safe(JsonLib.dumps(value, default = default, ensure_ascii=False).replace('</', '<\\/')) |
59 | 59 | ||
60 | @register.assignment_tag | 60 | @register.assignment_tag |
61 | def query(qs, **kwargs): | 61 | def query(qs, **kwargs): |