Thanks. It simplifies a lot of my current flow.
By the way, how am I supposed to finish the function? Just a return
statement? Or redirect?
Or could I just leave it empty? Meaning:
def register_onvalidation():
command1
command2
(Do I need here a return statement?)
Thanks,
Tsvi Mostovicz
[email protected]
www.linkedin.com/in/tsvim
On Tue, Jan 3, 2012 at 14:28, Alan Etkin <[email protected]> wrote:
> If you are using the auth object as configured in the scaffolding app
> model, it is possible to customize auth with this variables (maybe the
> list is incomplete):
>
> auth.settings.register_onvalidation
> auth.settings.register_onaccept
> auth.settings.register_next
>
> .._onvalidation is a list of functions to run on validation, so you
> can define the extra code there.
>
> On 3 ene, 08:42, tsvim <[email protected]> wrote:
> > Ok, I changed my code again.
> >
> > Incredible how so many things were though through before. (Multi-tenancy,
> > common_fields, extra_fields in auth, ...)
> > A big thumbs up to all the devs on this.
> >
> > What I'd like to do now is have a custom registration action (not form).
> > I added an extra_field to the auth_user table which should be stored
> from a
> > session variable.
> > I also would like to create a group based on that same variable and add
> the
> > user to that group.
> > So I should have something like this in my registration action:
> > auth.user.last_opened = session.token
> > auth.add_membership(auth.add_group(session.token), auth.user.id)
> >
> > Where last_opened is the name of the new field in auth_user.
> > The reason I want to use the add_membership is I'd like multiple users to
> > be able to share data according to the token.
> > This way new users can be added to the requested group, allowing them to
> > edit the data without touching the personal user's permissions.
> >
> > How do I go about creating my custom action?
> > Note that I'd like to still use the view available by the user action if
> > possible, or at least have the other user actions still available while
> > overriding the register action only.
> >
> > Thanks for your help,
> >
> > Tsvi
>