File diff 49f356923784 → ea8aa73f8ebb
conntrackt/views.py
Show inline comments
 
@@ -16,12 +16,34 @@ from braces.views import MultiplePermiss
 
# Application imports.
 
from .forms import ProjectForm, LocationForm, EntityForm, InterfaceForm, CommunicationForm
 
from .models import Project, Entity, Location, Interface, Communication
 
from .utils import generate_entity_iptables, generate_project_diagram
 

	
 

	
 
class RedirectToNextMixin(object):
 
    """
 
    View mixin that can be used for redirecting the user to URL defined through
 
    a GET parameter. The mixin is usable with Create/Update/Delete views that
 
    utilise the get_success_url() call.
 

	
 
    The mixin accepts the following class options:
 

	
 
        next_parameter - Name of the GET parameter that contains the redirect
 
        URL. Defaults to "next".
 
    """
 

	
 
    next_parameter = "next"
 

	
 
    def get_success_url(self):
 
        """
 
        Returns the success URL to which the user will be redirected.
 
        """
 

	
 
        return self.request.GET.get(self.next_parameter, super(RedirectToNextMixin, self).get_success_url())
 

	
 

	
 
class IndexView(MultiplePermissionsRequiredMixin, TemplateView):
 
    """
 
    Custom view used for rendering the index page.
 
    """
 

	
 
    template_name = 'conntrackt/index.html'