The Base View

class flask_kibble.base.KibbleView
action = None

The name of the action this view performs.

classmethod ancestor_labels()

Labels for each of the ancestors in Path.

ancestors = []

An array of ancestor ndb.Model classes.

base_context()

The base context the view should provide to the template.

Returns:Context dictionary
button_class = 'btn-default'

Bootstrap3 button class to be used when rendering the views button.

button_icon = None

Bootstrap3 icon classes to use when rendering the views button. If not provided, text will be used

classmethod has_permission_for(key=None)

Check if the user has the permissions required for this view.

Parameters:
  • key – A a ndb.Model instance or ndb.Key to perform row-level permission checks against.
  • instance – A ndb.Model instance to link to (optional)
hidden = False

Hidden classes will not be visible on the index and menu pages Can still be explicitly linked to with linked_actions.

classmethod kind()

Returns the name of the associated ndb.Model.

classmethod kind_label()

Returns a user friendly label for the associated :py:class`ndb.Model`.

Alternate labels can be defined in the Flask application setting KIBBLE_KIND_LABELS.

linked_actions = []

A list of associated views that this action can link to. Can either be a KibbleView subclass or an action name.

linked_descendant_views = []

A list of linked views for descendants.

model = None

The associated ndb.Model class this action deals with

classmethod path()

The “Path” of the view. Will return slash-separated ancestral path.

templates

The views templates.

Defaults to:
  • ‘’kibble/{path.lower}/{action}.html``
  • kibble/{kind.lower}/{action}.html
  • kibble/{action}.html
classmethod url_for(key=None, ancestor_key=None, blueprint='', **kwargs)

Get the URL for this view.

Parameters:
  • key – A a ndb.Model instance or ndb.Key to link to (optional)
  • blueprint – The blueprint name the view is registered to. If not provided, the current requests blueprint will be used. (optional)
Returns:

View URL

classmethod view_name()

Returns the name of the flask endpoint for this view.

Defaults to <kind.lower>_<action> or <ancestor.lower>_<kind.lower>_<action> for ancestor views.