Events¶
Get Events API¶
-
ls.joyous.models.
getAllEventsByDay
(request, fromDate, toDate, *, home=None, holidays=None)[source]¶ Return all the events (under home if given) for the dates given, grouped by day.
Parameters: - request – Django request object
- fromDate – starting date (inclusive)
- toDate – finish date (inclusive)
- home – only include events that are under this page (if given)
- holidays – the holidays that are celebrated for these dates
Return type: list of
EventsOnDay
objects
-
ls.joyous.models.
getAllEventsByWeek
(request, year, month, *, home=None, holidays=None)[source]¶ Return all the events (under home if given) for the given month, grouped by week.
Parameters: Returns: a list of sublists (one for each week) each of 7 elements which are either None for days outside of the month, or the events on the day.
Return type: list of lists of None or
EventsOnDay
objects
-
ls.joyous.models.
getAllUpcomingEvents
(request, *, home=None, holidays=None)[source]¶ Return all the upcoming events (under home if given).
Parameters: - request – Django request object
- home – only include events that are under this page (if given)
- holidays – holidays that may affect these events
Return type: list of ThisEvents
-
ls.joyous.models.
getAllPastEvents
(request, *, home=None, holidays=None)[source]¶ Return all the past events (under home if given).
Parameters: - request – Django request object
- home – only include events that are under this page (if given)
- holidays – holidays that may affect these events
Return type: list of the ThisEvents
-
ls.joyous.models.
getGroupUpcomingEvents
(request, group, holidays=None)[source]¶ Return all the upcoming events that are assigned to the specified group.
Parameters: - request – Django request object
- group – for this group page
- holidays – holidays that may affect these events
Return type: list of ThisEvents
-
ls.joyous.models.
getEventFromUid
(request, uid)[source]¶ Get the event by its UID (raises PermissionDenied if we have no authority, ObjectDoesNotExist if it is not found).
Parameters: - request – Django request object
- uid – iCal unique identifier
Return type: event page
-
ls.joyous.models.
getAllEvents
(request, *, home=None, holidays=None)[source]¶ Return all the events (under home if given).
Parameters: - request – Django request object
- home – only include events that are under this page (if given)
- holidays – holidays that may affect these events
Return type: list of event pages
EventsOnDay¶
-
class
ls.joyous.models.
EventsOnDay
(date, holiday=None, days_events=None, continuing_events=None)[source]¶ The events that occur on a certain day. Both events that start on that day and events that are still continuing.
-
date
¶
-
holiday
¶
-
days_events
¶ The events that start on this day
Return type: list of the namedtuple ThisEvent (title, page, url)
-
continuing_events
¶ The events that are still continuing on this day
Return type: list of the namedtuple ThisEvent (title, page, url)
-
all_events
¶ All the events that occur on this day,
days_events + continuing_events
.
-
preview
¶ A short description of some of the events on this day (limited to 100 characters).
-
weekday
¶ The weekday abbreviation for this days (e.g. “mon”).
-
EventCategory¶
EventBase¶
-
class
ls.joyous.models.
EventBase
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
uid
¶ A unique identifier for the event, used for iCal import/export.
-
category
¶ What type of event is this?
-
image
¶ A banner image for the event.
-
time_from
¶ The time the event starts (optional).
-
time_to
¶ The time the event finishes (optional).
-
tz
¶ The time zone for the event. No, sorry, you can’t set different time zones for time_from and time_to.
-
group_page
¶ A page chosen to link a group of events together.
-
details
¶ Free text for whatever else you want to say about the event.
-
location
¶ Where the event will occur. If wagtailgmaps is installed MapFieldPanel will be used, but this is not a requirement.
-
website
¶ A website location for the event.
-
group
¶ The group this event belongs to. Adding the event as a child of a group automatically assigns the event to that group.
-
_current_datetime_from
¶ The datetime this event will start or did start in the local timezone, or None if it is finished.
-
_future_datetime_from
¶ The datetime this event next starts in the local timezone, or None if in the past.
-
_past_datetime_from
¶ The datetime this event previously started in the local timezone, or None if it never did.
-
_first_datetime_from
¶ The datetime this event first started in the local time zone, or None if it never did.
-
status
¶ The current status of the event (started, finished or pending).
-
status_text
¶ A text description of the current status of the event.
-
at
¶ A string describing what time the event starts (in the local time zone).
-
_getLocalWhen
(date_from, date_to=None)[source]¶ Returns a string describing when the event occurs (in the local time zone).
-
SimpleEventPage¶
-
class
ls.joyous.models.
SimpleEventPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, uid, category, image, time_from, time_to, tz, group_page, details, location, website, date)[source]¶ Bases:
ls.joyous.models.event_base.EventBase
,wagtail.core.models.Page
-
date
¶ The date that the event occurs on.
-
when
¶ A string describing when the event occurs (in the local time zone).
-
MultidayEventPage¶
-
class
ls.joyous.models.
MultidayEventPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, uid, category, image, time_from, time_to, tz, group_page, details, location, website, date_from, date_to)[source]¶ Bases:
ls.joyous.models.event_base.EventBase
,wagtail.core.models.Page
-
date_from
¶ The date the event starts.
-
date_to
¶ The date the event finishes.
-
when
¶ A string describing when the event occurs (in the local time zone).
-
RecurringEventPage¶
-
class
ls.joyous.models.
RecurringEventPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, uid, category, image, time_from, time_to, tz, group_page, details, location, website, repeat, num_days)[source]¶ Bases:
ls.joyous.models.event_base.EventBase
,wagtail.core.models.Page
-
repeat
¶ The recurrence rule of when the event occurs.
-
num_days
¶ The number of days an occurrence lasts for.
-
next_date
¶ Date when this event is next scheduled to occur in the local time zone (Does not include postponements, but does exclude cancellations)
-
_current_datetime_from
¶ The datetime this event will start or did start in the local timezone, or None if it is finished.
-
_future_datetime_from
¶ The datetime this event next starts in the local timezone, or None if in the past.
-
prev_date
¶ Date when this event last occurred in the local time zone (Does not include postponements, but does exclude cancellations)
-
_past_datetime_from
¶ The datetime this event previously started in the local time zone, or None if it never did.
-
_first_datetime_from
¶ The datetime this event first started in the local time zone, or None if it never did.
-
status
¶ The current status of the event (started, finished or pending).
-
status_text
¶ A text description of the current status of the event.
-
when
¶ A string describing when the event occurs (in the local time zone).
-
_getFromTime
(atDate=None)[source]¶ What was the time of this event? Due to time zones that depends what day we are talking about. If no day is given, assume today.
Parameters: atDate – day in local timezone for which we want the time_from Return type: time_from in local timezone
-
_futureExceptions
(request)[source]¶ Returns all future extra info, cancellations and postponements created for this recurring event
-
_nextOn
(request)[source]¶ Formatted date/time of when this event (including any postponements) will next be on
-
_occursOn
(myDate)[source]¶ Returns true iff an occurence of this event starts on this date (given in the event’s own timezone).
(Does not include postponements, but does exclude cancellations.)
-
MultidayRecurringEventPage¶
-
class
ls.joyous.models.
MultidayRecurringEventPage
(*args, **kwargs)[source]¶ Bases:
ls.joyous.utils.mixins.ProxyPageMixin
,ls.joyous.models.recurring_events.RecurringEventPage
A proxy of RecurringEventPage that exposes the hidden num_days field.
EventExceptionBase¶
-
class
ls.joyous.models.
EventExceptionBase
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
overrides
¶ The recurring event that we are updating. overrides is also the parent (the published version of parent), but the parent is not set until the child is saved and added.
-
num_days
¶ Shortcut for overrides.num_days.
-
time_from
¶ Shortcut for overrides.time_from.
-
time_to
¶ Shortcut for overrides.time_to.
-
tz
¶ Shortcut for overrides.tz.
-
group
¶ Shortcut for overrides.group.
-
category
¶ Shortcut for overrides.category.
-
image
¶ Shortcut for overrides.image.
-
location
¶ Shortcut for overrides.location.
-
website
¶ Shortcut for overrides.website.
-
at
¶ A string describing what time the event starts (in the local time zone).
-
overrides_repeat
¶ The recurrence rule of the event being overridden.
-
DateExceptionBase¶
-
class
ls.joyous.models.
DateExceptionBase
(*args, **kwargs)[source]¶ Bases:
ls.joyous.models.recurring_events.EventExceptionBase
-
except_date
¶ For this date.
-
local_title
¶ Localised version of the human-readable title of the page.
-
when
¶ A string describing when the event occurs (in the local time zone).
-
full_clean
(*args, **kwargs)[source]¶ Apply fixups that need to happen before per-field validation occurs. Sets the page’s title.
-
ExtraInfoPage¶
-
class
ls.joyous.models.
ExtraInfoPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, overrides, except_date, extra_title, extra_information)[source]¶ Bases:
ls.joyous.models.recurring_events.DateExceptionBase
,wagtail.core.models.Page
-
extra_title
¶ A more specific title for this occurrence (optional).
-
extra_information
¶ Information just for this date.
-
details
¶ Shortcut for overrides.details.
-
status
¶ The current status of the event (started, finished or pending).
-
status_text
¶ A text description of the current status of the event.
-
_current_datetime_from
¶ The datetime this event will start or did start in the local timezone, or None if it is finished.
-
_future_datetime_from
¶ The datetime this event next starts in the local timezone, or None if in the past.
-
_past_datetime_from
¶ The datetime this event previously started in the local timezone, or None if it never did.
-
CancellationBase¶
-
class
ls.joyous.models.
CancellationBase
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
cancellation_title
¶ Show in place of cancelled event (Leave empty to show nothing).
-
cancellation_details
¶ Why was the event cancelled?
-
status
¶ The current status of the event
-
status_text
¶ A text description of the current status of the event.
-
CancellationPage¶
-
class
ls.joyous.models.
CancellationPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, overrides, except_date, cancellation_title, cancellation_details)[source]¶ Bases:
ls.joyous.models.recurring_events.CancellationBase
,ls.joyous.models.recurring_events.DateExceptionBase
,wagtail.core.models.Page
-
_current_datetime_from
¶ The datetime the event that was cancelled would start in the local timezone, or None if it would have finished by now.
-
_future_datetime_from
¶ The datetime the event that was cancelled would start in the local timezone, or None if that is in the past.
-
_past_datetime_from
¶ The datetime of the event that was cancelled in the local timezone, or None if it never would have.
-
getCancellationUrl
(request=None)[source]¶ The URL to a page describing the cancellation for Postponements and plain Cancellations.
-
cancellation_url
¶ The URL to a page describing the cancellation for Postponements and plain Cancellations.
-
RescheduleEventBase¶
-
class
ls.joyous.models.
RescheduleEventBase
(*args, **kwargs)[source]¶ Bases:
ls.joyous.models.event_base.EventBase
This class exists just so that the class attributes defined here are picked up by Django before the properties from EventExceptionBase, as well as before EventBase.
-
num_days
¶ The number of days an occurrence lasts for.
-
tz
¶ Shortcut for overrides.tz.
-
group
¶ Shortcut for overrides.group.
-
uid
¶ Shortcut for overrides.uid.
-
get_context
(request, *args, **kwargs)¶
-
PostponementPage¶
-
class
ls.joyous.models.
PostponementPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, overrides, except_date, cancellation_title, cancellation_details, cancellationpage_ptr, category, image, time_from, time_to, details, location, website, num_days, postponement_title, date)[source]¶ Bases:
wagtail.contrib.routable_page.models.RoutablePageMixin
,ls.joyous.models.recurring_events.RescheduleEventBase
,ls.joyous.models.recurring_events.CancellationPage
-
postponement_title
¶ The title for the postponed event.
-
date
¶ The date that the event was postponed to.
-
status
¶ The current status of the event (started, finished or pending).
-
when
¶ A string describing when the postponement occurs (in the local time zone).
-
postponed_from_when
¶ A string describing when the event was postponed from (in the local time zone).
-
what
¶ May return a ‘postponed’ or ‘rescheduled’ string depending what the start and finish time of the event has been changed to.
-
postponed_from
¶ Date that the event was postponed from (in the local time zone).
-
postponed_to
¶ Date that the event was postponed to (in the local time zone).
-
at
¶ A string describing what time the event starts (in the local time zone).
-
RescheduleMultidayEventPage¶
-
class
ls.joyous.models.
RescheduleMultidayEventPage
(*args, **kwargs)[source]¶ Bases:
ls.joyous.utils.mixins.ProxyPageMixin
,ls.joyous.models.recurring_events.PostponementPage
A proxy of PostponementPage that exposes the hidden num_days field.
ClosedForHolidaysPage¶
-
class
ls.joyous.models.
ClosedForHolidaysPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, overrides, cancellation_title, cancellation_details, all_holidays)[source]¶ Bases:
ls.joyous.models.recurring_events.CancellationBase
,ls.joyous.models.recurring_events.EventExceptionBase
,wagtail.core.models.Page
-
all_holidays
¶ Closed for all holidays?
-
closed_for
¶ Or, closed for these holidays
-
local_title
¶ Localised version of the human-readable title of the page.
-
when
¶ A string describing when the event occurs (in the local time zone).
-
closed
¶ The list of holidays we are closed for, or “ALL” if we are closed for all holidays.
-
_current_datetime_from
¶ The datetime the event that was cancelled would start in the local timezone, or None if it would have finished by now.
-
_future_datetime_from
¶ The datetime the event that was cancelled would start in the local timezone, or None if that is in the past.
-
_past_datetime_from
¶ The datetime of the event that was cancelled in the local timezone, or None if it never would have.
-
_closed_for_dates
¶ Return all the dates which we are closed for in the local timezone
-
classmethod
can_create_at
(parent)[source]¶ Checks if this page type can be created as a subpage under a parent page instance.
-
ExtCancellationPage¶
-
class
ls.joyous.models.
ExtCancellationPage
(id, path, depth, numchild, translation_key, locale, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, locked_at, locked_by, first_published_at, last_published_at, latest_revision_created_at, live_revision, alias_of, page_ptr, overrides, cancellation_title, cancellation_details, cancelled_from_date, cancelled_to_date)[source]¶ Bases:
ls.joyous.models.recurring_events.CancellationBase
,ls.joyous.models.recurring_events.EventExceptionBase
,wagtail.core.models.Page
-
cancelled_from_date
¶ Cancelled from this date
-
cancelled_to_date
¶ Cancelled to this date (Leave empty for “until further notice”)
-
local_title
¶ Localised version of the human-readable title of the page.
-
until_when
¶ A string describing how long we are cancelled for
-
when
¶ A string describing when the event occurs (in the local time zone).
-
_current_datetime_from
¶ The datetime the event that was cancelled would start in the local timezone, or None if it would have finished by now.
-
_future_datetime_from
¶ The datetime the event that was cancelled would start in the local timezone, or None if that is in the past.
-
_past_datetime_from
¶ The datetime of the event that was cancelled in the local timezone, or None if it never would have.
-
full_clean
(*args, **kwargs)[source]¶ Apply fixups that need to happen before per-field validation occurs. Sets the page’s title.
-
_getMyDates
(fromDate=datetime.date(1, 1, 1), toDate=datetime.date(3000, 12, 31))[source]¶ Return all the dates which we are cancelled for in the event timezone. Only if the event occurs on those dates. Limited by fromDate and toDate if given.
-