from django.views.generic import RedirectView


class RouteRedirectView(RedirectView):
    """Redirect to the target Route."""
    def get_redirect_url(self, *args, **kwargs):
        """
        Return the route's target url.

        Save the route's redirect type for use by RedirectView.
        """
        redirect = kwargs['route']
        self.permanent = redirect.permanent
        return redirect.target.url

from django.views.generic import RedirectView


class RouteRedirectView(RedirectView):
    """Redirect to the target Route."""
    permanent = True  # Set to django 1.9's default to avoid RemovedInDjango19Warning

    def get_redirect_url(self, *args, **kwargs):
        """
        Return the route's target url.

        Save the route's redirect type for use by RedirectView.
        """
        redirect = kwargs['route']
        self.permanent = redirect.permanent
        return redirect.target.url

Set variable to future default
Set variable to future default

Deprecation warning was:

    RemovedInDjango19Warning: Default value of 'RedirectView.permanent' will
    change from True to False in Django 1.9. Set an explicit value to
    silence this warning.

  from django.views.generic import RedirectView
  
  
  class RouteRedirectView(RedirectView):
      """Redirect to the target Route."""
+     permanent = True  # Set to django 1.9's default to avoid RemovedInDjango19Warning
+ 
      def get_redirect_url(self, *args, **kwargs):
          """
          Return the route's target url.
  
          Save the route's redirect type for use by RedirectView.
          """
          redirect = kwargs['route']
          self.permanent = redirect.permanent
          return redirect.target.url
  
Set variable to future default
## Code Before:
from django.views.generic import RedirectView


class RouteRedirectView(RedirectView):
    """Redirect to the target Route."""
    def get_redirect_url(self, *args, **kwargs):
        """
        Return the route's target url.

        Save the route's redirect type for use by RedirectView.
        """
        redirect = kwargs['route']
        self.permanent = redirect.permanent
        return redirect.target.url

## Instruction:
Set variable to future default
## Code After:
from django.views.generic import RedirectView


class RouteRedirectView(RedirectView):
    """Redirect to the target Route."""
    permanent = True  # Set to django 1.9's default to avoid RemovedInDjango19Warning

    def get_redirect_url(self, *args, **kwargs):
        """
        Return the route's target url.

        Save the route's redirect type for use by RedirectView.
        """
        redirect = kwargs['route']
        self.permanent = redirect.permanent
        return redirect.target.url
