Example #1
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 #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=JSONEncoder)
Example #4
0
 def render_json(self, context):
     return json.dumps(addon_to_dict(context['addon']), cls=JSONEncoder)
Example #5
0
 def render_json(self, context):
     return json.dumps([addon_to_dict(a) for a in context['addons']],
                       cls=JSONEncoder)
Example #6
0
 def render_json(self, context):
     return json.dumps(addon_to_dict(context['addon']), cls=JSONEncoder)