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

Documentation fixes.

parent 1e0c4211
- Core - Core
- Right-side menu items (auth?)
- Pregenerate URLs for menu - Pregenerate URLs for menu
- Model Admin - Model Admin
- Ability to sort by fields that are not visible? - 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:: ...@@ -47,9 +47,15 @@ You must create `Admin` class and associate it with the `Flask` application::
app.run() 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 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 Adding first view
----------------- -----------------
...@@ -182,6 +188,8 @@ you can do something like this:: ...@@ -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` It is very easy to add support for different database backends (Mongo, etc) by inheriting from `BaseModelView`
class and implementing database-related methods. class and implementing database-related methods.
Please refer to documentation on how to customize behavior of model-based administrative views.
Examples Examples
-------- --------
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
{% if item.is_category() %} {% if item.is_category() %}
{% set children = item.get_children() %} {% set children = item.get_children() %}
{% if 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> <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ item.name }}<b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for child in children %} {% 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> <a href="{{ child.get_url() }}">{{ child.name }}</a>
</li> </li>
{% endfor %} {% endfor %}
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
{% if item.is_accessible() %} {% 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> <a href="{{ item.get_url() }}">{{ item.name }}</a>
</li> </li>
{% endif %} {% endif %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% set column = 0 %} {% set column = 0 %}
{% for c, name in list_columns %} {% for c, name in list_columns %}
<th> <th>
{% if admin_.is_sortable(c) %} {% if admin_view.is_sortable(c) %}
{% if sort_column == column %} {% if sort_column == column %}
<a href="{{ sort_url(column, True) }}"> <a href="{{ sort_url(column, True) }}">
{{ name }} {{ name }}
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
{% for row in data %} {% for row in data %}
<tr> <tr>
<td> <td>
{%- if admin_.can_edit -%} {%- if admin_view.can_edit -%}
<a href="{{ url_for('.edit_view', id=row.id, return=return_url) }}"> <a href="{{ url_for('.edit_view', id=row.id, return=return_url) }}">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>
</a> </a>
{%- endif -%} {%- 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?')"> <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> <i class="icon-remove"></i>
</a> </a>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
{% endfor %} {% endfor %}
</table> </table>
{{ lib.pager(page, num_pages, pager_url) }} {{ 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> <a class="btn btn-primary btn-large" href="{{ url_for('.create_view', return=return_url) }}">Create New</a>
{% endif %} {% endif %}
{% endblock %} {% 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