Create & Edit

Create and Edit share some common attributes.

class flask_kibble.edit.FormView(*args, **kwargs)
base_form

The base formclass to generate the form from. By default this is an empty CSRF protected form.

alias of BaseCSRFForm

exclude_fields = None

An array of fields to skip when generating the form.

field_help_text = {}

Help text per field

fieldsets = []

An array of dictionaries specifying fieldsets. These should contain at least a name and fields values. All fields not specified will be grouped into an unordered remainder.

Example

[
    {'name':"Title", 'fields': ['title','slug']},
]
form = None

The wtforms.Form class to use. If not provided one will be generated through wtforms_ndb.model_form().

form_field_args = None

If no form is provided, These per-field arguments will passed through to wtforms_ndb.model_form().

get_form_fieldsets(instance=None)

Returns the fieldsets for the form.

Parameters:instance – The instance being edited.
Returns:Fieldset array
get_form_instance(instance=None)

Returns an instance of the form for the view.

Parameters:instance – The instance to edit or None.
get_success_message(instance)

Returns the message to flash to the user on a successful action.

Parameters:instance – The successfully saved instance.
Returns:Message to flash.
get_success_response(instance)

Called when the instance has been saved. Should return the URL to redirect to afterwards.

Parameters:instance – The successfully saved instance.
Returns:URL to redirect to.
model_converter = None

Action name A wtforms_ndb.ModelConverter class used to convert the NDB model to a form. If default will use the blueprint-global model converter.

only_fields = None

An array of fields to only use when generating the form.

save_model(form, instance=None, ancestor_key=None)

Called when a form is saved with no errors.

If no instance is present, it it up to this view to create a new instance.

Parameters:
  • form – The form instance
  • instance – The instance (if any) to save to.
Returns:

The saved instance

Return type:

ndb.Model

Create

class flask_kibble.Create(*args, **kwargs)
action = 'create'

View name

Edit

class flask_kibble.Create(*args, **kwargs)
action = 'create'

View name