Table Of Contents

Previous topic

6.1.2. badges.views — views for badges

Next topic

6.3. Document3D

This Page

Languages

Previous versions

1.2
1.1

6.2. calendrier – calendar generations

New in version 1.2.

This application can generate HTML calendars and iCalendar files. Currently it can generate a month view of an history page or of the timeline page.

6.2.1. How HTML calendars are generated

Short answer: using the calendar.HTMLCalendar class from the stdlib.

This article explains how to generate an HTML calendar using the HTMLCalendar class.

6.2.2. How iCalendar files are generated

Short answer: using django-ical.

6.2.3. Views

openPLM.apps.calendrier.views.parse_date(year, month)[source]

Parse year and month (string, integer or None) and returns a tuple of int (year, month).

If year is None, the current year is returned. If month is None, the current month is returned.

Raise :ValueError if year < 1900, year > 9999, month < 1, month > 12 or month and year can not be converted to an integer or (year == 9999 and month == 12)
class openPLM.apps.calendrier.views.HistoryCalendar(histories)[source]

Bases: calendar.HTMLCalendar

formatday(day, weekday)[source]
formatmonth(year, month)[source]
formatmonthname(*args, **kwargs)[source]
formatweekday(day)[source]

Return a weekday name as a table header.

formatweekheader()[source]

Return a header for a week as a table row.

formatweek(theweek)[source]

Return a complete week as a table row.

group_by_day(histories)[source]
day_cell(cssclass, body)[source]
format_hline(history)[source]
class openPLM.apps.calendrier.views.RevisionHistoryCalendar(histories)[source]

Bases: openPLM.apps.calendrier.views.HistoryCalendar

format_hline(history)[source]
class openPLM.apps.calendrier.views.TimelineCalendar(histories)[source]

Bases: openPLM.apps.calendrier.views.HistoryCalendar

group_by_day(histories)[source]
format_hline(history)[source]
openPLM.apps.calendrier.views.history_calendar(request, *args, **kwargs)[source]

Calendar view.

This view displays a history of the selected object and its revisions.

Url :/object/obj_type/obj_ref/obj_revi/history/calendar/[year/][month/]
Url :/user/username/history/calendar/[year/][month/]`
Url :/group/group_name/history/calendar/[year/][month/]`
Url :/timeline/calendar/[year/][month/]`
Parameters:
Returns:

a django.http.HttpResponse

Template:

calendar.html

Context:

RequestContext

calendar
the HTML calendar
year
the given year (or the current year if not given)
month
the given month (or the current month if not given)
current_month, next_month, previous_month
datetime.date objects representing the current, next and previous months (may be None if the date is 1900/01 or 9999/12).
ical_installed
True if django-ical is installed and iCalendar file can be generated
prefix_url
a prefix to prepend to the url to go to the next and previous monthes. (can be "", "../" or "../../").
openPLM.apps.calendrier.views.history(request, *args, **kwargs)[source]

A simple view that wraps display_object_history() to use the template history_cal.html

class openPLM.apps.calendrier.views.CalendarFeed[source]

Bases: openPLM.apps.rss.feeds.RssFeed, django_ical.views.ICalFeed

get_object(request, year=None, month=None, obj_type='-', obj_ref='-', obj_revi='-')[source]
items(obj)[source]
item_title(item)[source]
item_start_datetime(item)[source]
class openPLM.apps.calendrier.views.TimelineCalendarFeed[source]

Bases: openPLM.apps.rss.feeds.TimelineRssFeed, django_ical.views.ICalFeed

get_object(request, year=None, month=None)[source]
items(obj)[source]
item_title(item)[source]
item_start_datetime(item)[source]