def get_dates(self): if not self.series: start_date = self.start_date end_date = self.end_date if not end_date or self.single_day_event: end_date = start_date start_date_format = end_date_format = DATE_FORMAT["not_this_year"] now = datetime.now() if start_date.year == end_date.year: # start and end in the same year, so: start_date_format = DATE_FORMAT[ "not_this_month"] # start format example: "3rd May" if start_date.month == end_date.month: # start and end in the same month, so: start_date_format = DATE_FORMAT[ "this_month"] # start format example: "21st" if end_date.year == now.year: # they're both this year, so: end_date_format = DATE_FORMAT[ "not_this_month"] # end format example: "23rd May" if self.single_day_event: dates = nice_date(start_date, end_date_format) else: dates = nice_date(start_date, start_date_format) + unicode( _(u" to ")) + nice_date(end_date, end_date_format) return dates else: return "Series"
def get_when(self): """ get_when provides a human-readable attribute under which items can be grouped. Usually, this is an easily-readble rendering of the date (e.g. "April 2010") but it can also be "Top news", for items to be given special prominence. """ get_when = nice_date(self.get_start_date(), ARKESTRA_DATE_FORMATS["date_groups"]) return get_when
def get_when(self): """ get_when provides a human-readable attribute under which items can be grouped. Usually, this is an easily-readble rendering of the date (e.g. "April 2010") but it can also be "Top news", for items to be given special prominence. """ if getattr(self, "sticky", None): return "Top news" get_when = nice_date(self.date, DATE_FORMAT["date_groups"]) return get_when
def admin_metadata(self): date = nice_date(self.obj.date) if self.obj.published: status = "<strong>Published:</strong>" else: status = """ <span class='errornote'>Not published</span> """ return """ %s %s """ % (status, self.date())
def get_dates(self): if not self.series: start_date = self.start_date end_date = self.end_date if not end_date or self.single_day_event: end_date = start_date start_date_format = end_date_format = "l jS F Y" now = datetime.now() if start_date.year == end_date.year: # start and end in the same year, so: start_date_format = "l jS F" # start format example: "3rd May" if start_date.month == end_date.month: # start and end in the same month, so: start_date_format = "l jS" # start format example: "21st" if end_date.year == now.year: # they're both this year, so: end_date_format = "l jS F" # end format example: "23rd May" if self.single_day_event: dates = nice_date(start_date, end_date_format) else: dates = nice_date(start_date, start_date_format) + " to " + nice_date(end_date, end_date_format) return dates else: return "Series"
def get_dates(self): if not self.series: start_date = self.start_date end_date = self.end_date if not end_date or self.single_day_event: end_date = start_date start_date_format = end_date_format = DATE_FORMAT["not_this_year"] now = datetime.now() if start_date.year == end_date.year: # start and end in the same year, so: start_date_format = DATE_FORMAT["not_this_month"] # start format example: "3rd May" if start_date.month == end_date.month: # start and end in the same month, so: start_date_format = DATE_FORMAT["this_month"] # start format example: "21st" if end_date.year == now.year: # they're both this year, so: end_date_format = DATE_FORMAT["not_this_month"] # end format example: "23rd May" if self.single_day_event: dates = nice_date(start_date, end_date_format) else: dates = nice_date(start_date, start_date_format) + unicode(_(u" to ")) + nice_date(end_date, end_date_format) return dates else: return "Series"
def date(context, date=date): """ The `date` argument is a context attribute containing the date you want published; if not specified, the "date" will be used by default. """ date_format = "jS F Y" now = datetime.now() # this year? don't include the year if date.year == now.year: date_format = "jS F" # nicedate will use tomorrow, today or yesterday when appropriate date = nice_date(date, date_format) return date
def get_when(self): """ get_when provides a human-readable attribute under which items can be grouped. Usually, this is an easily-readble rendering of the date (e.g. "April 2010") but it can also be "Top news", for items to be given special prominence. """ try: # The render function of CMSNewsAndEventsPlugin can set a temporary sticky attribute for Top news items if self.sticky: return "Top news" except AttributeError: pass date_format = "F Y" get_when = nice_date(self.closing_date, date_format) return get_when
def date(self): return nice_date(self.obj.date)