|
@@ -253,13 +253,13 @@ def entity_iptables(request, pk):
|
|
|
"""
|
|
|
|
|
|
# Fetch the entity, and construct the response with iptables rules as
|
|
|
# content.
|
|
|
entity = get_object_or_404(Entity, pk=pk)
|
|
|
content = generate_entity_iptables(entity)
|
|
|
response = HttpResponse(content, mimetype='text/plain')
|
|
|
response = HttpResponse(content, content_type='text/plain')
|
|
|
|
|
|
# Add the Content-Disposition information for the browser, telling the
|
|
|
# browser to download the file with suggested filename.
|
|
|
response['Content-Disposition'] = "attachment; filename=%s-iptables.conf" % entity.name.lower().replace(" ", "_")
|
|
|
|
|
|
return response
|
|
@@ -296,13 +296,13 @@ def project_iptables(request, project_id
|
|
|
|
|
|
# Create a new ZIP file in-memory.
|
|
|
zipped_iptables = ZipFile(buff, "w", ZIP_DEFLATED)
|
|
|
|
|
|
# Create the response object, setting the mime type so browser could offer
|
|
|
# to open the file with program as well.
|
|
|
response = HttpResponse(mimetype='application/zip')
|
|
|
response = HttpResponse(content_type='application/zip')
|
|
|
|
|
|
# If specific location was specified, get the entities that are part of that
|
|
|
# project location only, otherwise fetch all of the project's entities. Also
|
|
|
# set-up the filename that will be suggested to the browser.
|
|
|
if location_id:
|
|
|
location = get_object_or_404(Location, pk=location_id)
|
|
@@ -1002,13 +1002,13 @@ def project_diagram(request, pk):
|
|
|
project = get_object_or_404(Project, pk=pk)
|
|
|
|
|
|
# Generate the diagram.
|
|
|
content = generate_project_diagram(project).create_svg()
|
|
|
|
|
|
# Set the mime type.
|
|
|
response = HttpResponse(content, mimetype='image/svg+xml')
|
|
|
response = HttpResponse(content, content_type='image/svg+xml')
|
|
|
|
|
|
# Return the response object.
|
|
|
return response
|
|
|
|
|
|
|
|
|
class SearchView(MultiplePermissionsRequiredMixin, TemplateView):
|
|
@@ -1126,10 +1126,10 @@ class APISearchView(MultiplePermissionsR
|
|
|
"project": project.name,
|
|
|
"type": "project",
|
|
|
"url": project.get_absolute_url()})
|
|
|
|
|
|
# Generate the JSON response.
|
|
|
content = json.dumps(items)
|
|
|
response = HttpResponse(content, mimetype="application/json")
|
|
|
response = HttpResponse(content, content_type="application/json")
|
|
|
|
|
|
# Return the response.
|
|
|
return response
|