[ANN] Started development on web2admin

525 views
Skip to first unread message

rif

unread,
Sep 10, 2012, 9:49:35 AM9/10/12
to web...@googlegroups.com
I started the development of a new django-like admin interface.

You can find it here: https://github.com/rif/web2admin 

It is very basic but still usable because it uses SQLFORM.smartgrid.

I am announcing it early because I need your feedback and feature requests so that I can find out if grid will be able to support all the desired features.

For quick start you can create a w2a_root group and add your user to that group.

-rif

Marin Pranjić

unread,
Sep 10, 2012, 10:11:45 AM9/10/12
to web...@googlegroups.com
Github is having some database problem right now.
But thanks for sharing this - I will try it later.


-rif

--
 
 
 

rif

unread,
Sep 12, 2012, 11:51:30 AM9/12/12
to
Added plugin configuration options (inspired by sramana's instant-admin):
  • items per page
  • extra links in sidebar
Every day when I get some free time I am adding some new features. If you have requests or bug reports please don't hesitate :)

Thanks,
-rif

rif

unread,
Sep 12, 2012, 12:07:10 PM9/12/12
to web...@googlegroups.com
There was a problem with the installation from master tip tar gz. Created plugin archive for download here.

rif

unread,
Sep 13, 2012, 5:22:24 PM9/13/12
to web...@googlegroups.com
New features:
  • Admin logo configuration
  • Actions (execute functions on multiple rows)
  • w2a_export permission for restricting export feature
  • Screenshots in readme :)
  • Tweaks and bug fixes 
More to come:
  • Table fields exclusion
  • Filters (easy restrict range of displayed rows)
  • Inline tables (related tables on a single row)
  • Your suggestion here
-rif 

Bruno Rocha

unread,
Sep 13, 2012, 5:45:31 PM9/13/12
to web...@googlegroups.com
Nice work!

the select2.js is the same as choosen? I really like it! should have a web2py widget for this.

SUGGESTION:

it is very annoying to request "host/app/plugin_web2admin" the url does not looks good. To change this, the hard option is tricking on routes. But there is an easy way:

NOTE: it is a tricky, maybe it can change in the future, for now it works nice.

On top of  MODELS/PLUGIN_WEB2ADMIN.PY add

if request.controller == 'web2admin':
    request.controller = 'plugin_web2admin'
    response.view = response.view.replace('web2admin', 'plugin_web2admin')


now you can calll "localhost:8000/app/web2admin/" 

I will start to use this, great work!

** is there a license?

rif

unread,
Sep 14, 2012, 3:02:26 AM9/14/12
to web...@googlegroups.com
Hi rochacbruno, thank you for the kind words.

Yes select2 should be an improvement over chosen, I found about it here: https://github.com/h5bp/lazyweb-requests/issues/92 (they are planning to upgrade standard select). A widget would be great.

The url trick is very welcome I will get it in the release today, thank you.

The fields feature is ready and today I will work on action history (to keep a log of actions in the admin) and filters.

-rif

Massimo Di Pierro

unread,
Sep 14, 2012, 9:39:50 AM9/14/12
to web...@googlegroups.com
This is really nice? If you think this is ready for production (or when you think it is ready for production) let me know. Where do you do you think would be a place to link it to make it more visible?

massimo

rif

unread,
Sep 14, 2012, 9:59:13 AM9/14/12
to web...@googlegroups.com
Thank you massimo,

Just added history, fields selection and better access url. I am working on filters and on using the links and left parameters from smartgrid.

Considering that most of the heavy lifting is done by the brilliant smartgrid I think it is quite ready for beta testing (and any bug report is appreciated). However there are more features in the pipeline so whenever you consider it to have enough features you can start using it.

About the place for visibility: well, my goal is to make it stand near plugin_wiki ;)

-rif

Massimo Di Pierro

unread,
Sep 14, 2012, 12:49:02 PM9/14/12
to web...@googlegroups.com


On Friday, September 14, 2012 8:59:13 AM UTC-5, rif wrote:
Thank you massimo,

Just added history, fields selection and better access url. I am working on filters and on using the links and left parameters from smartgrid.

Considering that most of the heavy lifting is done by the brilliant smartgrid I think it is quite ready for beta testing (and any bug report is appreciated). However there are more features in the pipeline so whenever you consider it to have enough features you can start using it.

About the place for visibility: well, my goal is to make it stand near plugin_wiki ;)

That can be done. Give me a few days to re-arrange that link and make it point to a link of "features" apps and plugins including this, movuca, plugin_wiki, instant-press, .... what else?

Bruno Rocha

unread,
Sep 14, 2012, 1:33:50 PM9/14/12
to web...@googlegroups.com
There is Pyodel (learning tool), I dont know about the status of QAStak and PyForum.

@rif what about multiple databases and databases named differently? 

your code expects a "db" object, so I think you can put on the models a config variable for dbs

plugin_web2admin_dbs = [db, other_db, sessions_db, user_db]

So in plugin code you can check

if "plugin_web2admin_dbs" in globals():
    for db in  plugin_web2admin_dbs:
        # logic to create navbar menus to change the "db" context.


rif

unread,
Sep 14, 2012, 3:39:44 PM9/14/12
to web...@googlegroups.com
Excellent suggestion. dbs will be available in the next version.

-rif

Bruno Rocha

unread,
Sep 14, 2012, 7:33:21 PM9/14/12
to web...@googlegroups.com
@rif I have some suggestion


For the suggested [fields] buttom it can be done with a modal or popup, it can loads a  <table style="display:none;" id="tablename_fields"> inside the popup or modal, or if prefered it can retrieve this info via ajax.

To retrieve the info is easy,

for field in table.fields:
    print name.name, name.type, name.length, name.comment, name.label, name.compute, name.represent, name.requires, name.required, name.unique, name.readable, name.writable
first_name string 128 None First name None None <gluon.validators.IS_NOT_EMPTY object at 0x1f05210> False False True True
 
So that info will be very important for developers and admins, also the buttom can show up only if admin is logged in.

Let me know if you need some help, I am using this and I really think it can be a replacement for appadmin.

rif

unread,
Sep 15, 2012, 5:43:35 AM9/15/12
to web...@googlegroups.com
I have added initial multi-db support and now I am working on your suggestion. It should be ready in a couple of hours. I will let you know.

-rif

Bruno Rocha

unread,
Sep 15, 2012, 6:03:28 AM9/15/12
to web...@googlegroups.com

I did that, a modal for field details... I did a pull-request with this, maybe you can improve the design.

Bruno Rocha

unread,
Sep 15, 2012, 6:10:48 AM9/15/12
to web...@googlegroups.com
I did the modal part, now need to do the shortcuts.

also as you are working on mult-db support, the code may change a little.

look:

Inline image 1

Inline image 2

rif

unread,
Sep 15, 2012, 6:20:28 AM9/15/12
to web...@googlegroups.com
You can pull from my devel branch for multi-db support. Please give me feedback.

I am merging your pull request. An I think I will use ajax.

-rif

Bruno Rocha

unread,
Sep 15, 2012, 6:31:25 AM9/15/12
to web...@googlegroups.com
Your call, also if you prefer to take the modal logic from modules/server side DOM on to HTML template it is easy to change.

I just created as Server side DOM because it can be reused.

rif

unread,
Sep 15, 2012, 8:20:06 AM9/15/12
to web...@googlegroups.com
I bow before what you showed in modules/html.py, yet I preferred a much simpler solution even if it is not reusable (hopefully it will give a chance to less-python-gurus like me to understand :).

I will focus on the rest of the suggestions now.

-rif

Alan Etkin

unread,
Sep 15, 2012, 8:25:27 AM9/15/12
to web...@googlegroups.com
Shouldn't this be called plugin_admin or similar (following the plugin_wiki fashion)?

Does w2x_etc naming use any plugin convention?. For instance, in Pyodel (also a plugin) I rely in an application manager role (without a prefix). Maybe we can adopt a standard naming convention for plugin roles. Also, I think that roles with prefixes somehow polute the group space.

rif

unread,
Sep 15, 2012, 8:38:14 AM9/15/12
to web...@googlegroups.com
I just thought that one might want to use the manager (without prefix) role for a different propose so I was just playing safe. I agree about namespace pollution.

We just need more opinions on this matter (Is it safe to just use manager role or general read/write/etc permissions?). And if we reach a conclusion I am happy to change.

Also the the plugin_web2admin->plugin_admin is OK, especially if it will become official :)

To others: please give feedback on this.

-rif

rif

unread,
Sep 16, 2012, 6:31:54 AM9/16/12
to web...@googlegroups.com
Check out the new global search, feedback most welcomed.

Features still to come:
  • Custom Links
  • Custom Left join

-rif

rif

unread,
Sep 18, 2012, 7:37:56 AM9/18/12
to web...@googlegroups.com
Lots of new customization options and features. Check it out and please report bugs.

-rif

rif

unread,
Sep 25, 2012, 6:24:53 AM9/25/12
to web...@googlegroups.com
Added django like filters to web2admin.

I will stop adding new features for a while and declare the current build as beta. Please test it and report issues on github.

Currently the GAE is not supported due to some dal issues.

Please test,
-rif

Alec Taylor

unread,
Sep 25, 2012, 6:29:13 AM9/25/12
to web...@googlegroups.com
Just a quick question, is your goal to eventually replace appadmin with this?

:)

--
 
 
 

Massimo Di Pierro

unread,
Sep 25, 2012, 8:19:51 AM9/25/12
to web...@googlegroups.com
No but it not excluded. I did not have time to review it in detail.

Massimo Di Pierro

unread,
Sep 25, 2012, 8:22:06 AM9/25/12
to web...@googlegroups.com
Let me add... appadmin was never developed to be a production tool. Something better like web2admin is very much welcome. I will review and we will discuss on this list whether to replace appadmin.

Some of the issues to be considered are:
- functionality
- bloat of the welcome app

rif

unread,
Sep 25, 2012, 12:48:42 PM9/25/12
to web...@googlegroups.com
I really hope that my code meets your standards and if you find something you don't like please let me know and I'll fix it.

The code is quite small (especially if the static folder is merged with the welcome app, I just extended the main layout).

Any functionality requests are welcomed for the 1.1 release.

-rif

Ovidio Marinho

unread,
Oct 11, 2012, 5:54:15 PM10/11/12
to web...@googlegroups.com
It really is a great job and I think it definitely will be incorporated as a standard interface for administration. A suggestion is to make a historic recording of data.
      


       Ovidio Marinho Falcao Neto
                Web Developer
             ovid...@gmail.com 
          ovidio...@itjp.net.br
                 ITJP - itjp.net.br
               83   8826 9088 - Oi
               83   9334 0266 - Claro
                        Brasil
              



2012/9/25 rif <feri...@gmail.com>
--
 
 
 

rif

unread,
Oct 12, 2012, 10:50:36 AM10/12/12
to web...@googlegroups.com
Thank you Ovidio. Do you mean like auth.enable_record_versioning? Can you give more details?

-rif

Manuele Pesenti

unread,
Jan 9, 2014, 6:28:37 PM1/9/14
to web...@googlegroups.com
Il 10/09/12 15:49, rif ha scritto:
> I started the development of a new django-like admin interface.
>
> You can find it here: https://github.com/rif/web2admin
>
> It is very basic but still usable because it uses SQLFORM.smartgrid.
>
> I am announcing it early because I need your feedback and feature
> requests so that I can find out if grid will be able to support all
> the desired features.
>
> For quick start you can create a w2a_root group and add your user to
> that group.
>
> -rif
> --
>
>
>
Dear rif,
many compliments for the project!
I found a problem with virtual fields... but I don't know if it's
related to your plugin or directly to web2py.
I added a very simple virtual field like this one:

db.testtable.testfield = Field.Virtual(lambda row: 'foo')

and I obtain this error:

Traceback (most recent call last):
File "/home/manuele/portali/web2py.git/gluon/restricted.py", line 217,
in restricted
exec ccode in environment
File
"/home/manuele/portali/web2py.git/applications/paytorviewer/controllers/plugin_web2admin.py",
line 116, in <module>
File "/home/manuele/portali/web2py.git/gluon/globals.py", line 372, in
<lambda>
self._caller = lambda f: f()
File "/home/manuele/portali/web2py.git/gluon/tools.py", line 3239, in f
return action(*a, **b)
File
"/home/manuele/portali/web2py.git/applications/paytorviewer/controllers/plugin_web2admin.py",
line 34, in view_table
showbuttontext = plugins.web2admin.showbuttontext,
File "/home/manuele/portali/web2py.git/gluon/sqlhtml.py", line 2770,
in smartgrid
user_signature=user_signature, **kwargs)
File "/home/manuele/portali/web2py.git/gluon/sqlhtml.py", line 2452,
in grid
value = row[str(field)]
File "/home/manuele/portali/web2py.git/gluon/dal.py", line 7362, in
__getitem__
raise ae
AttributeError: 'Row' object has no attribute 'unknown'

any idea?

Thank you

Manuele

rif

unread,
Jan 10, 2014, 5:12:55 AM1/10/14
to web...@googlegroups.com
I am checking it right now, be back soon.

-rif

rif

unread,
Jan 10, 2014, 6:46:24 AM1/10/14
to web...@googlegroups.com
Unfortunately it seems to be a web2py grid/smartgrid bug. I opened a ticket here: http://code.google.com/p/web2py/issues/detail?id=1851

Meanwhile please note that defining an old style virtual field does not break the smartgrid:
class MyVirtualFields(object):
        def testfield(self):
            return 'foo'
db.testtable.virtualfields.append(MyVirtualFields())

I'll make a few updates to web2py with this occasion :)

Thanks,

-rif

vineri, 10 ianuarie 2014, 01:28:37 UTC+2, Manuele a scris:

rif

unread,
Jan 10, 2014, 6:47:24 AM1/10/14
to web...@googlegroups.com
I meant a few updates to web2admin :)

Manuele Pesenti

unread,
Jan 10, 2014, 10:00:52 AM1/10/14
to web...@googlegroups.com
Il 10/01/14 12:47, rif ha scritto:
> I meant a few updates to web2admin :)
thank you very mutch rif for your interest!!
:) I'll use old style viertual fields for the moment

M.

rif

unread,
Jan 12, 2014, 5:39:28 AM1/12/14
to web...@googlegroups.com
Manuele: Massimo suggested adding the virtualfield name parameter like this:

db.testtable.testfield = Field.Virtual('testfield', lambda row: 'foo')

It works this way.

In my ticket (http://code.google.com/p/web2py/issues/detail?id=1851) I have taken the example directly from the book so I made a pull request to add it in the book example as well.

However it does not make too mutch sense as the name of the field is already specified in the db.testtable.testfield part.

-rif

Massimo Di Pierro

unread,
Jan 12, 2014, 10:15:03 AM1/12/14
to web...@googlegroups.com
The book is wrong. Fields should have a name. 
Reply all
Reply to author
Forward
0 new messages