Impressive outlook Villas, thank you. On Tuesday, July 21, 2020 at 12:16:29 PM UTC+2, villas wrote: > > Your my_validator function iterates through the whole table. This is OK > when you have a few records, but very inefficient if you have > thousands/millions. Why not simply query the table? Something like this... > > def my_validator(form): > if db((db.lecture.id == form.vars.id) & (db.lecture.lecture_time == > form.vars.lecture_time) > ).count() >0: > form.errors.lecturer=SPAN("Record already exists", > _style="font-weight: > bold;") > >
-- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/ea0ee397-ef21-4930-bab4-fa203443e913o%40googlegroups.com.