Changeset 7254


Ignore:
Timestamp:
3 Dec 2011, 05:09:21 (13 years ago)
Author:
Henrik Bettermann
Message:

Define formatDatetime (for displaying datetime objects in data tables) centrally in layout.py.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r7252 r7254  
    490490        return ''
    491491
    492     def formatDatetime(self,datetimeobj):
    493         if isinstance(datetimeobj, datetime):
    494             return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
    495         else:
    496             return None
    497 
    498492class AcceptanceFeePaymentAddPage(grok.View):
    499493    """ Page to add an online payment ticket
     
    889883        return
    890884
    891     def formatDatetime(self,datetimeobj):
    892         if isinstance(datetimeobj, datetime):
    893             return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
    894         else:
    895             return None
    896 
    897885    def unremovable(self, ticket):
    898886        usertype = getattr(self.request.principal, 'user_type', None)
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantdisplaypage.pt

    r7250 r7254  
    5959      <td> <a tal:attributes="href value/__name__">
    6060      <span tal:content="value/p_id">PID</span></a></td>
    61       <td tal:content="python: view.formatDatetime(value.creation_date)">CREATION DATE</td>
    62       <td tal:content="python: view.formatDatetime(value.payment_date)">PAYMENT DATE</td>
     61      <td tal:content="python: layout.formatDatetime(value.creation_date)">CREATION DATE</td>
     62      <td tal:content="python: layout.formatDatetime(value.payment_date)">PAYMENT DATE</td>
    6363      <td tal:content ="value/category">CATEGORY</td>
    6464      <td tal:content ="value/p_item">ITEM</td>
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicanteditpage.pt

    r7250 r7254  
    127127        <td> <a tal:attributes="href cl/__name__">
    128128        <span tal:content="cl/p_id">PID</span></a></td>
    129         <td tal:content="python: view.formatDatetime(cl.creation_date)">CREATION DATE</td>
    130         <td tal:content="python: view.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
     129        <td tal:content="python: layout.formatDatetime(cl.creation_date)">CREATION DATE</td>
     130        <td tal:content="python: layout.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
    131131      <td tal:content ="cl/category">CATEGORY</td>
    132132      <td tal:content ="cl/p_item">ITEM</td>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py

    r7243 r7254  
    2020import os
    2121import grok
     22from datetime import date, datetime
    2223import grokcore.view
    2324from hurry.resource import mode
     
    202203        return
    203204
     205    def formatDatetime(self,datetimeobj):
     206        if isinstance(datetimeobj, datetime):
     207            return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
     208        else:
     209            return None
     210
    204211    def update(self):
    205212        """Include the resources required by the chosen skin/theme.
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7253 r7254  
    959959#    pnav = 4
    960960
    961 #    def formatDatetime(self,datetimeobj):
    962 #        if isinstance(datetimeobj, datetime):
    963 #            return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
    964 #        else:
    965 #            return None
    966 
    967961#    @property
    968962#    def label(self):
     
    991985            return False
    992986        return (self.request.principal.user_type == 'student' and ticket.r_code)
    993 
    994     def formatDatetime(self,datetimeobj):
    995         if isinstance(datetimeobj, datetime):
    996             return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
    997         else:
    998             return None
    999987
    1000988    @property
     
    12581246    pnav = 4
    12591247    officers_only_actions = ['Remove selected']
    1260 
    1261     def formatDatetime(self,datetimeobj):
    1262         if isinstance(datetimeobj, datetime):
    1263             return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
    1264         else:
    1265             return None
    12661248
    12671249    @property
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/accommodationmanagepage.pt

    r7240 r7254  
    3434        <td> <a tal:attributes="href cl/__name__">
    3535        <span tal:content="python: cl.getSessionString()">PID</span></a></td>
    36         <td tal:content="python: view.formatDatetime(cl.booking_date)">DATE</td>
     36        <td tal:content="python: layout.formatDatetime(cl.booking_date)">DATE</td>
    3737        <td tal:content="cl/bed_coordinates">COORDINATES</td>
    3838        <td tal:content="cl/bed_type">TYPE</td>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentsmanagepage.pt

    r6940 r7254  
    3737        <td> <a tal:attributes="href cl/__name__">
    3838        <span tal:content="cl/p_id">PID</span></a></td>
    39         <td tal:content="python: view.formatDatetime(cl.creation_date)">CREATION DATE</td>
    40         <td tal:content="python: view.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
     39        <td tal:content="python: layout.formatDatetime(cl.creation_date)">CREATION DATE</td>
     40        <td tal:content="python: layout.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
    4141      <td tal:content ="cl/category">CATEGORY</td>
    4242      <td tal:content ="cl/p_item">ITEM</td>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentspage.pt

    r6869 r7254  
    1919      <td> <a tal:attributes="href value/__name__">
    2020      <span tal:content="value/p_id">PID</span></a></td>
    21       <td tal:content="python: view.formatDatetime(value.creation_date)">CREATION DATE</td>
    22       <td tal:content="python: view.formatDatetime(value.payment_date)">PAYMENT DATE</td>
     21      <td tal:content="python: layout.formatDatetime(value.creation_date)">CREATION DATE</td>
     22      <td tal:content="python: layout.formatDatetime(value.payment_date)">PAYMENT DATE</td>
    2323      <td tal:content ="value/category">CATEGORY</td>
    2424      <td tal:content ="value/p_item">ITEM</td>
Note: See TracChangeset for help on using the changeset viewer.