initialization.admin#

Classes#

AppJSONField

Copied from Flask-admin to replace json with simplejson with use_decimal=True

AppModelConverter

Custom converter for JSON and datetime fields

AppDateTimeField

Ensures that timestamps in the database are stored in the UTC timezone

AppAdminIndexView

Blocks the entire admin for non-admin users

AppView

Custom view with common functionality for ORM records

Functions#

json_formatter(_view, data, _name)

Format JSON using simplejson with use_decimal=True

json_page_visit_counter_formatter(_view, data, _name)

Format nested JSON as an HTML table, specifically for Page Visit records

record_formatter(_view, record, *args)

Format ORM records to make them easier to read

init_admin(app)

Main entry point of the module, initializes Flask-Admin for our Flask app

Module Contents#

initialization.admin.json_formatter(_view, data, _name)[source]#

Format JSON using simplejson with use_decimal=True

initialization.admin.json_page_visit_counter_formatter(_view, data, _name)[source]#

Format nested JSON as an HTML table, specifically for Page Visit records

initialization.admin.record_formatter(_view, record, *args)[source]#

Format ORM records to make them easier to read

class initialization.admin.AppJSONField[source]#

Bases: wtforms.fields.TextAreaField

Copied from Flask-admin to replace json with simplejson with use_decimal=True

process_formdata(valuelist)[source]#

Process data received over the wire from a form.

class initialization.admin.AppModelConverter[source]#

Bases: flask_admin.contrib.sqla.form.AdminModelConverter

Custom converter for JSON and datetime fields

convert_JSON(field_args, **extra)[source]#
convert_datetime(field_args, **extra)[source]#
class initialization.admin.AppDateTimeField[source]#

Bases: flask_admin.form.DateTimeField

Ensures that timestamps in the database are stored in the UTC timezone

process_formdata(valuelist)[source]#

Process data received over the wire from a form.

class initialization.admin.AppAdminIndexView[source]#

Bases: flask_admin.AdminIndexView

Blocks the entire admin for non-admin users

index()[source]#
class initialization.admin.AppView[source]#

Bases: flask_admin.contrib.sqla.ModelView

Custom view with common functionality for ORM records

can_export = True[source]#
can_view_details = True[source]#
column_default_sort = ('id', True)[source]#
model_form_converter[source]#

Custom converter for JSON and datetime

column_type_formatters[source]#

Custom formatters for the list view

column_type_formatters_export[source]#

Custom formatters for the export view

column_type_formatters_detail[source]#

Custom formatters for the detail view

is_accessible()[source]#

Only allow admin users to the admin

inaccessible_callback(name, **kwargs)[source]#

Raise 404 instead of 403 to hide the presence of the endpoint for bots

initialization.admin.init_admin(app)[source]#

Main entry point of the module, initializes Flask-Admin for our Flask app