Example #1
0
def collection_detail_json(request, username, slug):
    collection = get_collection(request, username, slug)
    if not (collection.listed
            or acl.check_collection_ownership(request, collection)):
        raise PermissionDenied
    # We evaluate the QuerySet with `list` to work around bug 866454.
    addons_dict = [addon_to_dict(a) for a in list(collection.addons.valid())]
    return {
        'name': collection.name,
        'url': collection.get_abs_url(),
        'addons': addons_dict
    }
Example #2
0
def collection_detail_json(request, username, slug):
    c = get_collection(request, username, slug)
    if not (c.listed or acl.check_collection_ownership(request, c)):
        raise PermissionDenied
    # We evaluate the QuerySet with `list` to work around bug 866454.
    addons_dict = [addon_to_dict(a) for a in list(c.addons.valid())]
    return {
        'name': c.name,
        'url': c.get_abs_url(),
        'iconUrl': c.icon_url,
        'addons': addons_dict
    }
Example #3
0
 def render_json(self, context):
     return json.dumps([addon_to_dict(a) for a in context['addons']],
                       cls=AMOJSONEncoder)
Example #4
0
 def render_json(self, context):
     return json.dumps(addon_to_dict(context['addon']), cls=AMOJSONEncoder)
Example #5
0
 def render_json(self, context):
     return json.dumps([addon_to_dict(a) for a in context['addons']],
                       cls=AMOJSONEncoder)
Example #6
0
 def render_json(self, context):
     return json.dumps(addon_to_dict(context['addon']), cls=AMOJSONEncoder)