0001-misc-use-application-javascript-for-menu.json-served.patch
hobo/views.py | ||
---|---|---|
133 | 133 | |
134 | 134 |
@admin_required |
135 | 135 |
def menu_json(request): |
136 |
response = HttpResponse(content_type='application/json') |
|
137 | 136 |
label = _('System') |
138 | 137 |
json_str = json.dumps([{'label': force_text(label), |
139 | 138 |
'slug': 'system', |
140 | 139 |
'url': request.build_absolute_uri(reverse('home')) |
141 | 140 |
}]) |
141 |
content_type = 'application/json' |
|
142 | 142 |
for variable in ('jsonpCallback', 'callback'): |
143 | 143 |
if variable in request.GET: |
144 | 144 |
json_str = '%s(%s);' % (request.GET[variable], json_str) |
145 |
content_type = 'application/javascript' |
|
145 | 146 |
break |
147 |
response = HttpResponse(content_type=content_type) |
|
146 | 148 |
response.write(json_str) |
147 | 149 |
return response |
148 |
- |