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.Modelclasses.
-
base_context()¶ The base context the view should provide to the template.
Returns: Context dictionary
Bootstrap3 button class to be used when rendering the views button.
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.Modelinstance orndb.Keyto perform row-level permission checks against. - instance – A ndb.Model instance to link to (optional)
- key – A a
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
KibbleViewsubclass or an action name.
-
linked_descendant_views= []¶ A list of linked views for descendants.
-
model= None¶ The associated
ndb.Modelclass 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}.htmlkibble/{action}.html
-
classmethod
url_for(key=None, ancestor_key=None, blueprint='', **kwargs)¶ Get the URL for this view.
Parameters: - key – A a
ndb.Modelinstance orndb.Keyto 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
- key – A a
-
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.
-