File diff 5c7da7c67a3e → 87d2821ecdfd
conntrackt/views.py
Show inline comments
 
@@ -122,24 +122,35 @@ class EntityView(MultiplePermissionsRequ
 
        template.
 

	
 
        Adds the 'entity_iptables' context object that contains full iptables
 
        rules generated for the entity.
 
        """
 

	
 
        # Call the parent class method.
 
        context = super(DetailView, self).get_context_data(**kwargs)
 

	
 
        # Add the rendered iptables rules to the context.
 
        context['entity_iptables'] = generate_entity_iptables(self.object)
 

	
 
        # Add the incoming and outgoing commmunication to the context.
 
        context["incoming_communications"] = self.object.incoming_communications()
 
        context["outgoing_communications"] = self.object.outgoing_communications()
 

	
 
        # Add the interfaces to the context.
 
        context["interfaces"] = self.object.interface_set.all().order_by("name")
 

	
 
        # Add project/location to the context.
 
        context["project"] = self.object.project
 
        context["location"] = self.object.location
 

	
 
        return context
 

	
 

	
 
@permission_required("conntrackt.view", raise_exception=True)
 
def entity_iptables(request, pk):
 
    """
 
    Custom view that returns response containing iptables rules generated for an
 
    entity.
 

	
 
    Makes sure to set the Content-Disposition of a response in order to
 
    signal the browser it should start download of this view's response
 
    immediately. Also sets the suggested filename for it.