from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic import DetailView

from models import Page
from settings import PARENT_SEPARATOR


ERROR404_MESSAGE = ("No %(verbose_name)s found matching the query") % {'verbose_name': Page._meta.verbose_name}

class PageDetailView(DetailView):
    model = Page

    def get_object(self, queryset=None):
        if queryset is None:
            queryset = self.get_queryset()

        slug = self.kwargs.get(self.slug_url_kwarg, None)
        slug_field = self.get_slug_field()

        slug_parts = slug.split(PARENT_SEPARATOR)

        try:
            obj = queryset.get(**{slug_field: slug_parts[-1]})
        except ObjectDoesNotExist:
            raise Http404(ERROR404_MESSAGE)

        if not obj.get_full_slug() == slug:
            raise Http404(ERROR404_MESSAGE)

        return obj

@@ -530,16 +530,21 @@
     slug
+_full
  = self.
@@ -641,21 +641,20 @@
 slug
-_parts
  = slug
+_full
 .spl
@@ -673,16 +673,20 @@
 PARATOR)
+%5B-1%5D
 %0A%0A      
@@ -746,18 +746,8 @@
 slug
-_parts%5B-1%5D
 %7D)%0A 
@@ -867,16 +867,21 @@
  == slug
+_full
 :%0A      

rename slug to slug_full and remove slug_parts while replacing it with slug in page detail view