def __init__(self, controller):

        defaults = dict(
            query_factory=default_query_factory,
            create_factory=default_create_factory,
            title=inflector.titleize(controller.proper_name),
            plural=inflector.underscore(controller.name),
            singular=inflector.underscore(
                inflector.singularize(controller.name)),
            ModelForm=model_form(controller.meta.Model),
            display_properties=sorted([
                name for name, property in
                controller.meta.Model._properties.items()
            ]),
            redirect=controller.uri(action='list') if controller.uri_exists(
                action='list') else None,
            form_action=None,
            form_encoding='application/x-www-form-urlencoded',
            flash_messages=True,
            layouts={
                None: 'layouts/default.html',
                'admin': 'layouts/admin.html'
            })

        for k, v in defaults.iteritems():
            if not hasattr(self, k):
                setattr(self, k, v)
Exemplo n.º 2
0
    def _scaffold_on_before_render(self, handler):

        self.template_vars['scaffolding'] = {
            'name': self.name,
            'proper_name': self.proper_name,
            'title': inflector.titleize(self.proper_name),
            'pluralized': inflector.pluralize(self.name),
            'singularized': inflector.singularize(self.name),
            'key_id_for': ndb_util.key_id_for,
            'key_urlsafe_for': ndb_util.key_urlsafe_for,
            'url_id_for': self.url_id_for,
            'use_ids': self.scaffold.use_ids,
            'form_action': self.scaffold.form_action,
            'form_encoding': self.scaffold.form_encoding
        }

        self._determine_display_properties()
Exemplo n.º 3
0
    def __init__(self, controller):

        defaults = dict(
            title=inflector.titleize(controller.proper_name),
            plural=inflector.underscore(controller.name),
            singular=inflector.underscore(inflector.singularize(controller.name)),
            ModelForm=model_form(controller.meta.Model),
            display_properties=[name for name, property in controller.meta.Model._properties.items()],
            redirect=controller.uri(action="list") if controller.uri_exists(action="list") else None,
            form_action=None,
            form_encoding="application/x-www-form-urlencoded",
            flash_messages=True,
        )

        for k, v in defaults.iteritems():
            if not hasattr(self, k):
                setattr(self, k, v)
Exemplo n.º 4
0
    def _scaffold_on_before_render(self, handler):

        self.template_vars['scaffolding'] = {
            'name': self.name,
            'proper_name': self.proper_name,
            'title': inflector.titleize(self.proper_name),
            'pluralized': inflector.pluralize(self.name),
            'singularized': inflector.singularize(self.name),
            'key_id_for': ndb_util.key_id_for,
            'key_urlsafe_for': ndb_util.key_urlsafe_for,
            'url_id_for': self.url_id_for,
            'use_ids': self.scaffold.use_ids,
            'form_action': self.scaffold.form_action,
            'form_encoding': self.scaffold.form_encoding
        }

        self._determine_display_properties()
Exemplo n.º 5
0
    def _scaffold_on_before_render(self, handler):

        self.template_vars["scaffolding"] = {
            "name": self.name,
            "proper_name": self.proper_name,
            "title": inflector.titleize(self.proper_name),
            "pluralized": inflector.pluralize(self.name),
            "singularized": inflector.singularize(self.name),
            "key_id_for": ndb_util.key_id_for,
            "key_urlsafe_for": ndb_util.key_urlsafe_for,
            "url_id_for": self.url_id_for,
            "use_ids": self.scaffold.use_ids,
            "form_action": self.scaffold.form_action,
            "form_encoding": self.scaffold.form_encoding,
        }

        self._determine_display_properties()
Exemplo n.º 6
0
    def __init__(self, controller):

        defaults = dict(
            query_factory=default_query_factory,
            create_factory=default_create_factory,
            title=inflector.titleize(controller.proper_name),
            plural=inflector.underscore(controller.name),
            singular=inflector.underscore(inflector.singularize(controller.name)),
            ModelForm=model_form(controller.meta.Model),
            display_properties=sorted([name for name, property in controller.meta.Model._properties.items()]),
            redirect=controller.uri(action="list") if controller.uri_exists(action="list") else None,
            form_action=None,
            form_encoding="application/x-www-form-urlencoded",
            flash_messages=True,
            layouts={None: "layouts/default.html", "admin": "layouts/admin.html"},
        )

        for k, v in defaults.iteritems():
            if not hasattr(self, k):
                setattr(self, k, v)
Exemplo n.º 7
0
    def __init__(self, controller):

        defaults = dict(
            title=inflector.titleize(controller.proper_name),
            plural=inflector.underscore(controller.name),
            singular=inflector.underscore(
                inflector.singularize(controller.name)),
            ModelForm=model_form(controller.meta.Model),
            display_properties=[
                name for name, property in
                controller.meta.Model._properties.items()
            ],
            redirect=controller.uri(action='list') if controller.uri_exists(
                action='list') else None,
            form_action=None,
            form_encoding='application/x-www-form-urlencoded',
            flash_messages=True)

        for k, v in defaults.iteritems():
            if not hasattr(self, k):
                setattr(self, k, v)