Commit 0e0dd4e8 authored by Serge S. Koval's avatar Serge S. Koval

Documentation fixes.

parent 1e0c4211
- Core
- Right-side menu items (auth?)
- Pregenerate URLs for menu
- Model Admin
- Ability to sort by fields that are not visible?
......
......@@ -47,9 +47,15 @@ You must create `Admin` class and associate it with the `Flask` application::
app.run()
If you will run this application and will navigate to `http://localhost:5000/admin/ <http://localhost:5000/admin/`_,
If you will run this application and will navigate to `http://localhost:5000/admin/ <http://localhost:5000/admin/>`_,
you should see lonely Home page with a navigation bar on top.
You can change application name by passing `name` parameter to the `Admin` class constructor::
admin = Admin(name='My App')
admin.setup_app(app)
Adding first view
-----------------
......@@ -182,6 +188,8 @@ you can do something like this::
It is very easy to add support for different database backends (Mongo, etc) by inheriting from `BaseModelView`
class and implementing database-related methods.
Please refer to documentation on how to customize behavior of model-based administrative views.
Examples
--------
......
......@@ -26,11 +26,11 @@
{% if item.is_category() %}
{% set children = item.get_children() %}
{% if children %}
{% if item.is_active(view) %}<li class="active dropdown">{% else %}<li class="dropdown">{% endif %}
{% if item.is_active(admin_view) %}<li class="active dropdown">{% else %}<li class="dropdown">{% endif %}
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ item.name }}<b class="caret"></b></a>
<ul class="dropdown-menu">
{% for child in children %}
{% if child.is_active(view) %}<li class="active">{% else %}<li>{% endif %}
{% if child.is_active(admin_view) %}<li class="active">{% else %}<li>{% endif %}
<a href="{{ child.get_url() }}">{{ child.name }}</a>
</li>
{% endfor %}
......@@ -39,7 +39,7 @@
{% endif %}
{% else %}
{% if item.is_accessible() %}
{% if item.is_active(view) %}<li class="active">{% else %}<li>{% endif %}
{% if item.is_active(admin_view) %}<li class="active">{% else %}<li>{% endif %}
<a href="{{ item.get_url() }}">{{ item.name }}</a>
</li>
{% endif %}
......
......@@ -9,7 +9,7 @@
{% set column = 0 %}
{% for c, name in list_columns %}
<th>
{% if admin_.is_sortable(c) %}
{% if admin_view.is_sortable(c) %}
{% if sort_column == column %}
<a href="{{ sort_url(column, True) }}">
{{ name }}
......@@ -33,12 +33,12 @@
{% for row in data %}
<tr>
<td>
{%- if admin_.can_edit -%}
{%- if admin_view.can_edit -%}
<a href="{{ url_for('.edit_view', id=row.id, return=return_url) }}">
<i class="icon-pencil"></i>
</a>
{%- endif -%}
{%- if admin_.can_delete -%}
{%- if admin_view.can_delete -%}
<a href="{{ url_for('.delete_view', id=row.id, return=return_url) }}" onclick="return confirm('You sure you want to delete this item?')">
<i class="icon-remove"></i>
</a>
......@@ -51,7 +51,7 @@
{% endfor %}
</table>
{{ lib.pager(page, num_pages, pager_url) }}
{% if admin_.can_create %}
{% if admin_view.can_create %}
<a class="btn btn-primary btn-large" href="{{ url_for('.create_view', return=return_url) }}">Create New</a>
{% endif %}
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment