<commit_before>Usage Tips
==========

General tips
------------

1. Whenever your administrative views share common functionality such as authentication,
form validation, make use of read-only views and so on - create your own base class which
inherits from proper Flask-Admin view class.

For example, if you need to check user permissions for every call, don't implement
`is_accessible` in  every administrative view. Create your own base class, implement
`is_accessible` there and use this class for all your views.

2. You can override used templates either by using `ModelView` properties (such as
`list_template`, `create_template`, `edit_template`) or
putting customized version of the template into your `templates/admin/` directory

3. If you need to customize look and feel of model forms, there are two options:

  - Override create/edit template
  - Use new :mod:`flask.ext.admin.form.rules` form rendering rules

4. Flask-Admin has that manage file/image uploads and store result in model field. You can
find documentation here - :mod:`flask.ext.admin.form.upload`.


SQLAlchemy
----------

1. If `synonym_property` does not return SQLAlchemy field, Flask-Admin
won't be able to figure out what to do with it and won't generate form
field. In this case, you need to manually contribute field::

    class MyView(ModelView):
        def scaffold_form(self):
            form_class = super(UserView, self).scaffold_form()
            form_class.extra = TextField('Extra')
            return form_class

MongoEngine
-----------

1. Flask-Admin supports GridFS backed image and file uploads. Done through
WTForms fields and documentation can be found here :mod:`flask.ext.admin.contrib.mongoengine.fields`.
<commit_msg>Doc fixes. Fixed #267<commit_after>Usage Tips
==========

General tips
------------

 1. Whenever your administrative views share common functionality such as authentication,
    form validation, make use of read-only views and so on - create your own base class which
    inherits from proper Flask-Admin view class.

    For example, if you need to check user permissions for every call, don't implement
    `is_accessible` in  every administrative view. Create your own base class, implement
    `is_accessible` there and use this class for all your views.

 2. You can override used templates either by using `ModelView` properties (such as
    `list_template`, `create_template`, `edit_template`) or
    putting customized version of the template into your `templates/admin/` directory

 3. If you need to customize look and feel of model forms, there are two options:
    - Override create/edit template
    - Use new :mod:`flask.ext.admin.form.rules` form rendering rules

 4. Flask-Admin has that manage file/image uploads and store result in model field. You can
    find documentation here :mod:`flask.ext.admin.form.upload`.

 5. If you don't want to use Flask-Admin form scaffolding logic, you can override
    :meth:`~flask.ext.admin.model.base.scaffold_form` and put your own form creation
    logic there. For example, if you use `WTForms-Alchemy <https://github.com/kvesteri/wtforms-alchemy>`_, all you have to do
    is to put appropriate form generation code into your `ModelView` class into the
    `scaffold_form` method.


SQLAlchemy
----------

1. If `synonym_property` does not return SQLAlchemy field, Flask-Admin
   won't be able to figure out what to do with it and won't generate form
   field. In this case, you need to manually contribute field::

    class MyView(ModelView):
        def scaffold_form(self):
            form_class = super(UserView, self).scaffold_form()
            form_class.extra = TextField('Extra')
            return form_class

MongoEngine
-----------

1. Flask-Admin supports GridFS backed image and file uploads. Done through
   WTForms fields and documentation can be found here :mod:`flask.ext.admin.contrib.mongoengine.fields`.

{'fraction_non_alphanumeric': 0.08605720122574055, 'fraction_numerical': 0.0040858018386108275, 'mean_word_length': 3.570595099183197, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '287859', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1018, 'n_words': 473}