Package: django-happenings
An event calendar app for Django.Features:Repeating and non-repeating eventsEvents that start and end on different daysSupport for cancelled eventsUpcoming events and current happenings listsAJAX supportDefault CSS & Javascript to help you get startedComing soon:better integration of categories and tagsmore views, including an agenda viewsupport for users++ moreNote about upgrading from previous versions: Upgrading your version of the app
is a good idea, but be aware that some updates to the app involve changes
to models, which may cause problems with your database. For this reason
I’ve included south migrations to help make upgrading easier. But you
should always be cautious and make sure to backup your database before
upgrading. To see a list of changes made for each version view the CHANGELOG.DependenciesRequired:Django 1.6+Python 2.6+, 3+pytzOptional:jQueryTwitter Bootstrap 3.0.0+ (w/ tooltip plugin)South (for database migrations)jQuery is used for AJAX and the ‘Today’ button on the calendar.TWBS is used to create popovers when an event is clicked on the calendar.Warningdjango-happenings now use Django migrations by default. South users have to adjust their settings:SOUTH_MIGRATION_MODULES={'taggit':'taggit.south_migrations','happenings':'happenings.south_migrations',}Quick InstallInstall withpip:$ pip install django-happeningsAddhappeningstoINSTALLED_APPS:INSTALLED_APPS=(...'happenings',)Include thedjango-happeningsURLconf in urls.py:url(r'^calendar/',include('happenings.urls',namespace='calendar'))If your are going to use different namespace then please setCALENDAR_URLS_NAMESPACEin settingsMake sure yourTIME_ZONEis set correctly in settings.py.Runpython manage.py migrateto create the models (replacemigratewithsyncdb happeningsif using older Django without South). If you’re running MySQL, be sure that
your database is properly configured to use time zones.Run the development server and go to127.0.0.1:8000/admin/to create and manage events.Check out the calendar at127.0.0.1:8000/calendar/.CustomizingThe quickest way to begin customizing the app is to override themiddle.htmltemplate by creating your own version in
<mytemplates>/happenings/middle.html (replace <mytemplates> with wherever
you keep your templates) and add the line{% extends 'base.html' %}(replace base.html with your base template). For a greater degree of customization,
you can copy and paste into your project all of the templates included in the app, and
change them to fit your needs.Be sure to include the packaged css & javascript into your base template if you
want to use them. Loading the default style into your template would
look something like (assuming staticfiles has been loaded):<link href=" {% static 'happenings/css/calendar.css' %}" rel="stylesheet">And the default javascript something like:<script src="{% static 'happenings/js/calendar.js' %}"></script>Template TagsTemplate tags are available by loadinghappenings_tagsinto your template:{% load happenings_tags %}This gives access to three template tags:show_calendar,upcoming_events, andcurrent_happenings.Useshow_calendarlike this:<div id="event-calendar">
    {% show_calendar request %}
</div>to display a calendar like the one in/calendar/, or like this:<div id="event-calendar" class="calendar-mini">
    {% show_calendar request mini=True %}
</div>to display a mini calendar. The<div>shown allows you to use the styles
included with the app, but you can omit or change them if you want to use
your own style. Note also that, because the request object needs to be
included in the tag, you must include “django.core.context_processors.request”
in TEMPLATE_CONTEXT_PROCESSORS in your settings.py.Includeupcoming_eventsin your template like this:{% upcoming_events %}to display a list of the next 5 (or less) upcoming events within the next 90 days.
If you’d like to show events that occur outside of 90 days, or show more events in the
list, use thefinishandnumoptions:{% upcoming_events finish=365 num=8 %}Includecurrent_happeningsin your template like this:{% current_happenings %}to display a list of events that are happening now.LocaleThere are no translations from English yet, but if you’d like to display the calendar
and the event list in a different language, you can useCALENDAR_LOCALE. The upcoming
events list won’t be translated, though. For that you’ll need to specify yourLANGUAGE_CODEin the Django settings. Also note that to useCALENDAR_LOCALEyou’ll need to have the correct
locale pack installed for your system. Example of changing the language to German:CALENDAR_LOCALE = 'de_DE.utf8'Example of changing to U.S. English:CALENDAR_LOCALE = 'en_US.utf8'By default, the system’s locale is used, so settingCALENDAR_LOCALEalso ensures that you’re
using the locale you want.Optional SettingsYou can specify different settings for the app in your settings.py file.UseCALENDAR_URLS_NAMESPACEif you includedhappenings.urlswith namespace other than'calendar'UseCALENDAR_COLORSto add a custom color to the drop down in the admin when
creating an event. Example of setting the custom color ‘fuchsia’:CALENDAR_COLORS = [('ff00ff', 'fuchsia')]UseCALENDAR_START_DAYto change the day on which the calendar starts. Example
of starting the calendar on Sunday (instead of the default of Monday):CALENDAR_START_DAY = 6Defaulttime formatis “TIME_FORMAT” (user locale dependend ifUSE_L10Nis used or default django format if not used). This can be changed with next setting:CALENDAR_TIME_FORMAT = 'H:i'
## or
# CALENDAR_HOUR_FORMAT = 'g:iA'  # 12 hour format with AM/PMIn titles of events minutes may be stripped from time when there are 0 minutes. This depends on i18 settings and your CALENDAR_TIME_FORMAT settings. You may set some specific value with next setting:CALENDAR_HOUR_FORMAT = 'H'
## or
# CALENDAR_HOUR_FORMAT = 'gA'  # 12 hour format with AM/PM

## or if you do not want minutes to be stripped
# CALENDAR_HOUR_FORMAT = 'H:i'Upgrading from 0.2.X to 0.3.XStarting from 0.3.1 calendar rendering uses django templates to generate calendar
cells (templates/happenings/partials/calendar/*.html`).
If you haven’t customized anything and used default settings then everything will
still work out of the box.If you have sublcassedEventCalendarorMiniEventCalendarcalendar then you have 2 options:subclassLegacyEventCalendarorLegacyMiniEventCalendar. You should also setCALENDAR_LEGACY_TIME_FORMATin settings.copytemplates/happenings/partials/calendar/*.html`templates to your projecttemplatesdirectory and customize themIf you are using customCALENDAR_TIME_FORMATsetting then you also have 2 options:Just remove this setting and use default setting of djangoTIME_FORMAT.change it from python strftime notation toDjango (PHP) notation.  SpecifyingCALENDAR_HOUR_FORMATis also a good idea:# CALENDAR_TIME_FORMAT = '%H:%M'  # pre 0.3.1 versionCALENDAR_TIME_FORMAT='H:i'CALENDAR_HOUR_FORMAT='H'If you usedevent.l_start_date()/event.l_end_date()/event.start_end_diff()in your code:They are now cached_properties: use them without brackets or useget_FOO()(example:get_l_start_date())Event details template (tempaltes/happenings/event_detail.html) now uses"SHORT_DATE_FORMAT"instead of"D F d, Y"format. To use old format either change SHORT_DATE_FORMAT in settings or copy templates and change them as you like.Url to day details view (EventDayView) is now build usingreverse. This may have broken rendering for projects which includedhappenings.urlsin their urlconf with namespace other than"calendar". In such case you have to setCALENDAR_URLS_NAMESPACEin settings to namespace that you use (empty string is allowed for those who do not use namespace).Starting from 0.3.3 django happenings does not uselocale.setlocaleand fully utilizesi18nfeatures if django. To set default calendar language you should setLANGUAGE_CODEin settings. If you have enabled language switching for your site then calendar
will switch languages too. If you are not using legacy calendars thenCALENDAR_LOCALEsettings is not required anymore.Note that only month names and weekday names are translated for all languages supported by django.
Some django-happenings specific strings are only available in English (like “When/Description” in
event details). You can generate your own translations (pull requests are welcome) or you may copy
and change templates.TestsToxis used for testing.$ pip install tox$ tox-epy27-django16More To Come!