Hi, I'm trying to make a user control panel in turbo gears. My approach 
right now is to use the built in CRUD classes that create a table form like 
the EasyCrud stuff. 

I can get the current user's data by doing this with the EditFormFiller and 
it will return the data related to the user with id of 3 like their 
user_name, email_address etc:

class editFiller(EditFormFiller):
    __model__=User
editQuery = editFiller(DBSession)
testValue = editQuery.get_value(values={'user_id':'3'})

But I'm trying to do it with the TableBase so that I can get a nice Table 
generated that has the CRUD controls. 
So I'm trying this: 

class crudUserTableFiller(TableFiller):
    __model__ = User
user_table_filler = crudUserTableFiller(DBSession)
aWidget = user_table_filler.get_value(values={'user_id':'3'}, limit=2, 
offset=0)

>From the sprox.TableFillerBase 
here: http://sprox.org/modules/sprox.fillerbase.html# it shows that 
'aWidget' should produce just the values to fill up the table. But it 
actually gives me:d
{'user_id': u'1', 'created': u'12/03/2012 11:47AM', 'user_name': 
u'manager', '__actions__': u'<div><div>&nbsp;<a href="1/edit" 
style="text-decoration:none">edit</a></div><div><form method="POST" 
action="1" class="button-to"><input type="hidden" name="_method" 
value="DELETE" /><input class="delete-button" onclick="return confirm(\'Are 
you sure?\');" value="delete" type="submit" style="background-color: 
transparent; float:left; border:0; color: #286571; display: inline; margin: 
0; padding: 0;"/></form></div></div>', 'groups': u'managers', 'address': 
u'None', '_password': '******', 'password': '******', 'email_address': 
u'[email protected]', 'display_name': u'Example manager'}{'user_id': 
u'2', 'created': u'12/03/2012 11:47AM', 'user_name': u'editor', 
'__actions__': u'<div><div>&nbsp;<a href="2/edit" 
style="text-decoration:none">edit</a></div><div><form method="POST" 
action="2" class="button-to"><input type="hidden" name="_method" 
value="DELETE" /><input class="delete-button" onclick="return confirm(\'Are 
you sure?\');" value="delete" type="submit" style="background-color: 
transparent; float:left; border:0; color: #286571; display: inline; margin: 
0; padding: 0;"/></form></div></div>', 'groups': u'editors', 'address': 
u'None', '_password': '******', 'password': '******', 'email_address': 
u'[email protected]', 'display_name': u'Example editor'}

So it is giving me some of the generated HTML that I'm supposed to get when 
I do this using the TableBase class 
here(http://sprox.org/modules/sprox.tablebase.html):
class crudUserTable1(TableBase):
    __model__ = User
    
user_table1 = crudUserTable1(DBSession)

class crudUserTableFiller(TableFiller):
    __model__ = User
user_table_filler = crudUserTableFiller(DBSession)
testTableFillerGet = user_table_filler.get_value()
myWidget = user_table1.__widget__(value=testTableFillerGet)

The output I get from myWidget is: <class 
'tw2.core.params.SproxDataGrid_s_s'>

Any help on making this work, or an easy way to let a user edit their own 
data only like this? Thanks. 

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/turbogears/-/GM83Irplz2kJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to