API Documentation

FullCalendar API

To get events we return JSON. The api is super simple, but perfectly functional.

To get the events you need three components in your GET request namely start, end and timezone so a URL would look something like this https://example.com/calendar/events?start=<start date and time>&end=<end date and time>&timezone='<timezone>'

This API is made for simple GET requests only and is based on what FullCalendar uses.

Models

class wagtail_eventcalendar.models.Category(*args, **kwargs)

Category to which an event belongs

exception DoesNotExist
exception MultipleObjectsReturned
clean()

Ensures that there are no circular references when it comes to nested categories.

description

Optional description of a specific category.

name

Required. Name of the category

parent

Optional. Not used currently. Planned for later as part of nested categories.

save(*args, **kwargs)

Overrides Page model save method. Handles the slug

slug

Required. Not used. Planned for later. Make it the same as the name for now.

class wagtail_eventcalendar.models.CategoryEventPage(*args, **kwargs)

Internally used model. Ignore.

exception DoesNotExist
exception MultipleObjectsReturned
class wagtail_eventcalendar.models.EventCalPage(*args, **kwargs)

Calendar entry/ an even base model.

exception DoesNotExist
exception MultipleObjectsReturned
categories

Optional category that a specific calendar entry may belong to

clean()

Checks that the end date and time occurs after the start date and date

description

Required. Description of the event/calendar entry

end_dt

Required. End datetime of the event/calender entry. Must be after start_dt else it raises a Validation Error

property get_categories

Gets all the event categories.

Return type

QuerySet

Returns

Queryset containing the Categories objects

property get_status_text

Shows the status text of a calender entry/event

Return type

Union[str, bool]

Returns

Str if the event is finished, or begun but not yet completed else false.

icalView(request, *args, **kwargs)

Route that returns an ical file for a specific event.

Parameters
  • request (HttpRequest) – Django HttpRequest

  • args – Normal request args

  • kwargs (dict) – Normal request kwargs

Return type

HttpResponse

Returns

ical file as part of HttpResponse with only the details of a specific event

image

Optional image to associate with a calendar entry. Only really useful for the website

location

Optional location information

problem_status

Optional true/false indicating whether there is an issue with an event. It is important to both the ical files and the website

problem_text

Optional text that describes what is wrong. Used in conjunction with problem_status. Requires problem_status = true to work at all.

save(*args, **kwargs)

Overloads the save method of the Page model. It applies the default image to a calendar entry/event if it doesn’t already have one.

start_dt

Required. Start datetime of the event/calender entry

class wagtail_eventcalendar.models.EventCalendar(*args, **kwargs)

Base calendar class which actually displays the calendar.

exception DoesNotExist
exception MultipleObjectsReturned
default_image

Default image to be used for calendar entries

description

Short description of the calendar.

getEvents(request)

Route that returns the events. Is accessed by fullcalender as the api to call

Parameters

request (HttpRequest) – Django request

Return type

HttpResponse

Returns

JSON of the events ard their details

getEventsByCategory(request, **kwargs)

Gets the events for a specific category for a specific timeframe. Is accessed by fullcalender.js

Parameters
  • request (HttpRequest) – Django request

  • kwargs (dict) – Django request kwargs

Return type

HttpResponse

Returns

HttpResponse

property get_categories

Gets the calendar categories that currently exist

Return type

QuerySet

Returns

Returns a Queryset of Category objects

property get_url

Gets the url of the calendar page

Return type

str

Returns

Url of the calendar page

icalView(request, *args, **kwargs)

Route that produces the ical files requested by clients.

Parameters
  • request (HttpRequest) – Django request

  • args – Django request args

  • kwargs (dict) – Django request kwargs

Return type

HttpResponse

Returns

HttpResponse containing an ical file

icalViewCategory(request, *args, **kwargs)

Route that produces the ical files requested by clients, but filtered for a specific category

Parameters
  • request (HttpRequest) – Django HttpRequest

  • args – Django request args

  • kwargs (dict) – Django request kwargs

Return type

HttpResponse

Returns

HttpResponse containing an ical file

viewByCategory(request, **kwargs)

View calendar by a specific category

Parameters
  • request (HttpRequest) – Django request

  • kwargs – Django request kwargs

Return type

HttpResponse

Returns

HttpResponse that shows a calendar filtered by a category