Hi Anthony,
Is byday just a string? If so, how could it have a "weekday" and an "n"
> attribute?
Yes, it is:
Field('byday',length=2,default='',notnull=True,unique=True)
>From the python dateutil docs I learned that this:
TODAY+relativedelta(weekday=FR)
gives me next Friday's date.
... and this:
TODAY+relativedelta(weekday=TH(+1))
next Thursday, which is today.
from exposing the code:
nowdate=request.now.date()
nowday=request.now.weekday()
for row in session.oh_rows:
if nowday==row.Day.id-1:
row.OpeningHours.date=nowdate
else:
byday=row.Day.byday
row.OpeningHours.date=nowdate+relativedelta(weekday=byday)
... I learned that FR and TH apparently aren't of type string. But I haven't
been able to figure out how to pass row.day.byday to relativedelta()
This: TODAY+relativedelta(weekday=FR) does work for everyday except TH which is
today.
| If so, how could it have a "weekday" and an "n" attribute?
The string cannot have a weekday attribute, and it doesn't need an n attribute
does it, because it's self.weekday.n or 1
I hope I provided you with sufficient information to help me solve the problem.
Kind regards,
Annet