web2py instant admin documentation release 0.1 - read the docs

22
Web2py Instant Admin Documentation Release 0.1 Ramana Mar 29, 2017

Upload: others

Post on 09-Feb-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin DocumentationRelease 0.1

Ramana

Mar 29, 2017

Page 2: Web2py Instant Admin Documentation Release 0.1 - Read the Docs
Page 3: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Contents

1 Web2py Instant Admin 31.1 What is it? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 How to Install? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Screenshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.4.1 Dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.2 List View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4.3 Edit View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.5 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.6 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.7 Inspiration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.8 Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.9 Author Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Installation 52.1 Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Features & Screenshots 73.1 Dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.2 Collapsible Sidebar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.3 List Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.3.1 Pagination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3.2 Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3.3 Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3.4 Bulk Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3.5 CRUD Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.4 Show Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.5 Edit Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.6 Create Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.7 Delete Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4 Customization 134.1 How to add additional links to sidebar? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.2 How to change the number of items displayed in list view? . . . . . . . . . . . . . . . . . . . . . . . 134.3 How to remove the ugly plugin_instant_admin from urls? . . . . . . . . . . . . . . . . . . . . . . . 13

5 Roadmap 17

i

Page 4: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

5.1 Big Ticket Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.2 Others . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

ii

Page 5: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

Contents:

Contents 1

Page 6: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

2 Contents

Page 7: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

CHAPTER 1

Web2py Instant Admin

What is it?

Web2py Instant Admin provides a professional, production ready administration interface for Web2py applications,with batteries included. It brings the powerful features of Django Admin and Rails Admin to Web2py world.

The project’s home page is at : http://sramana.in/web2py-instant-admin.

The latest version of this project can be found at : http://github.com/sramana/web2py-instant-admin.

See the demo here : http://w2padmin.appspot.com

How to Install?

Installation instructions are provided here.

Documentation

You can browse the online documentation at http://readthedocs.org/docs/web2py-instant-admin.

You can also download the PDF version for offline reading.

Screenshots

Dashboard

3

Page 8: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

List View

Edit View

Reporting Bugs

Please report the bugs/enhancements at http://github.com/sramana/web2py-instant-admin/issues.

License

This project is licensed under MIT license.

Inspiration

The HTML theme is stolen from RailsAdmin.

Contribution

Contributions and Feedback are most welcome. Please fork the project in GitHub and send me a pull request withyour patch.

Author Information

Ramana <[email protected]>

• http://bitbucket.org/sramana

• http://github.com/sramana

4 Chapter 1. Web2py Instant Admin

Page 9: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

CHAPTER 2

Installation

Note: I am assuming that you have a working copy of web2py app with models defined. If not, please visit http://www.web2py.com and follow the simple setup process.

1. Download the packed plugin (.w2p format) from here.

2. In Web2py Admin panel, navigate to your app and click on plugins.

3. Under ‘upload plugin file’, select the web2py.plugin.instant_admin.w2p file you just downloaded and click onupload.

4. Visit http://127.0.0.1:8000/your_app/plugin_instant_admin/welcome. (Replace your_app with the name of theapp where you uploaded the plugin)

5. You will be prompted with Login form. Login with username=a (if you are using email instead of username, [email protected]) and password=a. This is a super user account, with all permissions. You may want to changepassword immediately.

Next Steps

You should check out Customization section.

5

Page 10: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

6 Chapter 2. Installation

Page 11: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

CHAPTER 3

Features & Screenshots

Dashboard

The dashboard is the default landing page for logged-in users. It lists all the models along with the number of recordsin each model. Only those models for which the logged-in user has read permission are displayed.

Collapsible Sidebar

The sidebar lists the models for which the logged-in user has read permissions. Clicking on the model takes the userto that model’s list page.

The sidebar can be toggled (shown/hidden) by clicking on the blue arrow icon the top navigation menu. The state isremembered across sessions. It is very helpful when your models have long columns by providing more horizontalspace.

7

Page 12: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

List Page

Note: This page requires read permission on the model.

List page is the most complex part of admin interface. It lists the records of a model in tabular form. Boolean fieldsare represented as yes/no icons.

8 Chapter 3. Features & Screenshots

Page 13: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

Pagination

By default, the records are displayed in groups of 20. A beautiful pagination bar aids in navigating through theremaining records.

Sorting

By default, the records are sorted by ID in descending order (so that you can view the latest entries first). You can clickon any column to sort the table by that column in ascending order. Clicking the same column again sorts the table indescending order.

Warning: Sorting text fields in Google App Engine is not supported due to GAE limitations.

Searching

You can search for a string in any column (except BLOB columns) by entering the string in search box.

Warning: Search won’t work in Google App Engine due to limitations on OR queries.

Bulk Delete

Select the records by clicking the check boxes and click on ‘Delete selected’ button to delete the records in one go.

CRUD Icons

The list page gives quick links to add a new record and view/edit/delete a particular record. These links appear only ifthe logged-in user has appropriate permissions.

Show Page

Note: This page requires read permission on the model.

Show page displays a single record with links to edit/delete (if authorized). Foreign keys link to parent record, Imagesare displayed inline, other files link to their download page.

3.4. Show Page 9

Page 14: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

Edit Page

Note: This page requires edit permission on the model.

Edit page allows you to edit a record. All the fields have beautiful layout, thanks to Activo theme.

Create Page

Note: This page requires create permission on the model.

This page looks exactly similar to edit page, except that all fields are initially blank.

Delete Page

Note: This page requires delete permission on the model.

This page allows to delete a single record or a group of records after confirmation.

10 Chapter 3. Features & Screenshots

Page 15: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

3.7. Delete Page 11

Page 16: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

12 Chapter 3. Features & Screenshots

Page 17: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

CHAPTER 4

Customization

How to add additional links to sidebar?

In your models (for example, db.py), set :

1. plugins.instant_admin.extra_sidebar_title to the title of your sidebar.

2. plugins.instant_admin.extra_sidebar to a list of A objects.

For example, if you put this in db.py

plugins.instant_admin.extra_sidebar_title = "My Custom Sidebar"plugins.instant_admin.extra_sidebar = [

A('Google', _href='http://google.com'),A('New User', _href=URL('new', args='users')),

]

you will get :

How to change the number of items displayed in list view?

In your models (for example, db.py), set plugins.instant_admin.items_per_page to a number of your choice. Thedefault is 20.

How to remove the ugly plugin_instant_admin from urls?

You need to use routes.py file for this. Here I show you how to rename ‘plugin_instant_admin’ to ‘admin’ in urls.

1. If you don’t have routes.py in root directory of web2py installation, create it and add these lines.

13

Page 18: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

14 Chapter 4. Customization

Page 19: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

routes_in = (('/$app/admin/$anything', '/$app/plugin_instant_admin/$anything'),

)

routes_out = [(x, y) for (y, x) in routes_in]

2. If you already have routes.py :

(a) add this line to routes_in tuple.

('/$app/admin/$anything', '/$app/plugin_instant_admin/$anything')

(b) add this line to routes_out tuple.

('/$app/plugin_instant_admin/$anything', '/$app/admin/$anything')

4.3. How to remove the ugly plugin_instant_admin from urls? 15

Page 20: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

16 Chapter 4. Customization

Page 21: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

CHAPTER 5

Roadmap

Here is the list of awesome stuff you can expect in upcoming versions. Please feel free to suggest your ideas.

Big Ticket Items

• Grid and Block views in list pages

• Bookmarks

• History tables

• Filters (like Django)

• Custom Actions (like Django)

• Support for multi db

• Auto complete in search and edit forms

• Instant Search (like Google Instant)

• Use ajax wherever possible

• Show recent actions (like Django)

• Inline models (like Django)

• Test automation

Others

• Interface to better manage Auth tables

• Ability to organize models into groups for easy browsing

• Ability to group fields into fieldsets for painless editing of models with several fields.

17

Page 22: Web2py Instant Admin Documentation Release 0.1 - Read the Docs

Web2py Instant Admin Documentation, Release 0.1

• Customizable top navigation bar

• Export data in csv, xml and json formats

• Ability to specify which columns to include in search to save time

• Painless interface for many-many to fields

• Show related records in delete view

• Ability to add a record to parent model if the required record is not found in the dropdown menu.

• Painless dropdown lists

18 Chapter 5. Roadmap