Custom Memberdata - Birthdays and date format
I added birthday (type=Date) to portal_memberdata in the ZMI for my Plone site. I edited the My Preferences form to include Birthday. I then created a custom python script called getMember: roster=[] for member in context.portal_membership.listMembers(): roster.append( { 'id':member.getUserName() , 'email':member.email , 'birthday':member.birthday , 'fullname': member.fullname }) return roster And then I use some of the output of that script in a page template using the following: <table> <tr tal:repeat="member here/getMembers"> <td tal:content="string:${member/fullname}">Column 1 dummy data</td> <td tal:content="string:${member/birthday}">Column 2 dummy data</td> </tr> </table> The problem is that I cannot get the birthday date string data formatted with just Month, Day and I have no idea as to how to sort this data my month. --Jim __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
Jim Barbara wrote at 2003-8-17 14:14 -0700:
I added birthday (type=Date) to portal_memberdata in the ZMI for my Plone site. I edited the My Preferences form to include Birthday. I then created a custom python script called getMember:
roster=[] for member in context.portal_membership.listMembers(): roster.append( { 'id':member.getUserName() , 'email':member.email , 'birthday':member.birthday , 'fullname': member.fullname }) return roster
And then I use some of the output of that script in a page template using the following:
<table> <tr tal:repeat="member here/getMembers"> <td tal:content="string:${member/fullname}">Column 1 dummy data</td> <td tal:content="string:${member/birthday}">Column 2 dummy data</td> </tr> </table>
The problem is that I cannot get the birthday date string data formatted with just Month, Day
What type has your "birthday"? When it is a "DateTime" (often called "date" type), then the "DateTime" documentation in "DateTime/DateTime.html" tells you which methods you can use (among others "day", "month" and "strftime"). When it is a string, you may need to split it into its components (probably using the "split" method of strings). You can then use the Python's formatting operator ("%") to reformat the string.
and
I have no idea as to how to sort this data my month.
Split the birthday into month and other (as a pair) and sort the resulting list via the list method "sort". Reformat later as needed. Dieter
participants (2)
-
Dieter Maurer -
Jim Barbara