Esempio n. 1
0
 def create_object(self):
     pagename = clean_name(self.kwargs["original_slug"])
     content = "<p>Describe %s here</p>" % pagename
     if "template" in self.request.GET:
         try:
             p = Page.objects.get(slug=self.request.GET["template"])
             content = p.content
         except Page.DoesNotExist:
             pass
     return Page(name=url_to_name(self.kwargs["original_slug"]), content=content)
Esempio n. 2
0
 def create_object(self):
     pagename = clean_name(self.kwargs['original_slug'])
     content = '<p>Describe %s here</p>' % pagename
     if 'template' in self.request.GET:
         try:
             p = Page.objects.get(slug=self.request.GET['template'])
             content = p.content
         except Page.DoesNotExist:
             pass
     return Page(name=url_to_name(self.kwargs['original_slug']),
                 content=content)
Esempio n. 3
0
    def is_valid(self, bundle, request=None):
        errors = {}

        pagename = bundle.data.get('name')
        if pagename:
            if pagename != clean_name(pagename):
                errors['name'] = ['Pagename cannot contain underscores or '
                    'a / character surrounded by spaces. Please replace '
                    'underscores with spaces and remove spaces surrounding the'
                    ' / character.'
                ]
        print 'ERROS', errors
        return errors
Esempio n. 4
0
    def is_valid(self, bundle, request=None):
        errors = {}

        pagename = bundle.data.get('name')
        if pagename:
            if pagename != clean_name(pagename):
                errors['name'] = ['Pagename cannot contain underscores or '
                    'a / character surrounded by spaces. Please replace '
                    'underscores with spaces and remove spaces surrounding the'
                    ' / character.'
                ]
        print 'ERROS', errors
        return errors
Esempio n. 5
0
File: api.py Progetto: pvl/localwiki
    def is_valid(self, bundle, request=None):
        errors = {}

        pagename = bundle.data.get("name")
        if pagename:
            if pagename != clean_name(pagename):
                errors["name"] = [
                    "Pagename cannot contain underscores or "
                    "a / character surrounded by spaces. Please replace "
                    "underscores with spaces and remove spaces surrounding the"
                    " / character."
                ]
        print "ERROS", errors
        return errors