File diff 9996f5fcde31 → a5941ab6ea3b
conntrackt/views.py
Show inline comments
 
@@ -15,6 +15,7 @@ from braces.views import MultiplePermiss
 
from .models import Project, Entity, Location
 
from .utils import generate_entity_iptables
 

	
 

	
 
class IndexView(MultiplePermissionsRequiredMixin, TemplateView):
 
    """
 
    Custom view used for rendering the index page.
 
@@ -128,7 +129,7 @@ class EntityView(MultiplePermissionsRequ
 
        return context
 

	
 

	
 
@permission_required("conntrackt.view", raise_exception = True)
 
@permission_required("conntrackt.view", raise_exception=True)
 
def entity_iptables(request, pk):
 
    """
 
    Custom view that returns response containing iptables rules generated for an
 
@@ -153,15 +154,15 @@ def entity_iptables(request, pk):
 
    entity = get_object_or_404(Entity, pk=pk)
 
    content = generate_entity_iptables(entity)
 
    response = HttpResponse(content, mimetype='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(" ", "_")
 
    response['Content-Disposition'] = "attachment; filename=%s-iptables.conf" % entity.name.lower().replace(" ", "_")
 

	
 
    return response
 

	
 

	
 
@permission_required("conntrackt.view", raise_exception = True)
 
@permission_required("conntrackt.view", raise_exception=True)
 
def project_iptables(request, project_id, location_id=None):
 
    """
 
    Custom view for obtaining iptables for all entities of a project or project
 
@@ -228,4 +229,3 @@ def project_iptables(request, project_id
 

	
 
    # Finally return the response object.
 
    return response