Or better:
if not 'last_name' in form.vars:
description = \
'group uniquely assigned to %(first_name)s'\
% form.vars
else:
description = \
'group uniquely assigned to %(first_name)s %
(last_name)s'\
% form.vars
(adding this in trunk!)
With this change you can actually define a custom db.auth_user without
last_name but you will also need in your model:
db.auth_membership.user_id.requires = IS_IN_DB(db, '%s.id' %
auth.settings.table_user._tablename,
'%(id)s: %(first_name)s')
db.auth_event.user_id.requires = IS_IN_DB(db, '%s.id' %
auth.settings.table_user._tablename,
'%(id)s: %(first_name)s')
On Oct 22, 3:21 pm, selecta <[email protected]> wrote:
> First of all, thanks for this awsome tool. I love it! Just discoverd
> it last Friday and I already build a rocking application that will go
> live soon. After having years of experience building web pages and
> also 3 years of Python I was almost ready to switch to RoR but always
> go stuck learing Ruby then I discovered web2py by accident and I am
> hooked Thanks Thanks Thanks.
>
> But to buissness:
> I followedhttp://www.web2py.com/examples/default/tools#authentication
> to customize my auth_user table
> First of all there is a mistake in the code for # define custom tables
> instead of self.settings.table_user_name it should read
> auth.settings.table_user_name
> Second I wanted to delete first_name and last_name to replace it by
> just name however this is not possible (discovered another posting
> about that later), it would be nice if this would be stated in the
> docu i just linked above.
> After reverting back to the original auth_user I thought I could just
> hide the last_name and auto fill it with
> db.auth_user.last_name.default = 'A'
> db.auth_user.last_name.readable = False
> db.auth_user.last_name.writable = False
> but this does not work ...
> Traceback (most recent call last):
> File "/home/select/Dev/web2py/gluon/restricted.py", line 178, in
> restricted
> exec ccode in environment
> File "/home/select/Dev/web2py/applications/frisur/controllers/
> default.py", line 80, in <module>
> File "/home/select/Dev/web2py/gluon/globals.py", line 102, in
> <lambda>
> self._caller = lambda f: f()
> File "/home/select/Dev/web2py/applications/frisur/controllers/
> default.py", line 59, in user
> return dict(form=auth())
> File "/home/select/Dev/web2py/gluon/tools.py", line 481, in __call__
> return self.register()
> File "/home/select/Dev/web2py/gluon/tools.py", line 938, in register
> % form.vars
> KeyError: 'last_name'
>
> I guess I can create a custom form or overwrite the table (?? which is
> the best), but I wonder why the above does not work.
>
> Hope you can help thanks so far, you really are the bomb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---