El Thu, 2 Apr 2015 06:46:30 -0700 (PDT) Annet <anneve...@googlemail.com> escribió:
> I a table I defined the following field: > > Field('expiryDate', type='date', > requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y')) > > By default the expiryDate is set to request.now, since there's no > need to monthly update > the expiry date, I want to calculate it when the user actually > updates or cancels his account. > > So if expiryDate is set to 28-11-2014 and the user updates his > account on 6-04-2015, the > expiryDate is 28-04-2015, and when the user updates his account on > 30-04-2015, the > expiryDate is 28-05-2015 > > I had a look at relativedelta to solve this problem, but I wonder > whether there is an easier > way to solve this problem within web2py. > > > Kind regards, > > Annet > Could you show or tell if there are more tables related to the one you want to work expirations in?. I can only think in a updates table related to users and expirations, so when an update occurs this should trigger a function that works on expirations table. I'll try to elaborate an example. Marco. -- 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. For more options, visit https://groups.google.com/d/optout.