Some ideas for automatic field values

23 views
Skip to first unread message

Carlos Cesar Caballero

unread,
Jul 30, 2016, 2:06:17 AM7/30/16
to web2py-users
Hi everyone, I am almost finishing a plugin for building automatic slug fields, but I want to build editable slugs.

I can right now when the user creates a new record in the database, fill a field with the slug, but I need the ability to update it too.
If the field is created for the very first time, I have an algoritm to create the slug (simply using the IS_SLUG validator), but if the field is edited, I need to use a different one, the problem is that the calculated field feature not specify whether the field is created or edited (or at least I don't find it), and I can't use the after_update trigger because it falls in an infinite loop when I update the field.

How can I do that?

Greetings.

José Luis Redrejo

unread,
Jul 30, 2016, 3:17:16 AM7/30/16
to web...@googlegroups.com

Have you tried update_naive when using the after_update trigger? It should avoid the infinite loop


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlos Cesar Caballero

unread,
Jul 30, 2016, 10:17:50 AM7/30/16
to web2py-users
Man, how could I miss that?, right in the doc... I will like to use a calculated field for that, but update_naive will work, many thanks.
Reply all
Reply to author
Forward
0 new messages