A simple event calendar app for Django.
Project description
An event calendar app for Django forked from https://github.com/wreckage/django-happenings to support newer Django versions.
All or most of the following text is from parent repository…
Features:
Repeating and non-repeating events
Events that start and end on different days
Support for cancelled events
Upcoming events and current happenings lists
AJAX support
Default CSS & Javascript to help you get started
Coming soon:
better integration of categories and tags
more views, including an agenda view
support for users
++ more
Note 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.
Dependencies
Required:
Django 1.8+
Python 2.7+, 3+
pytz
Optional:
jQuery
Twitter Bootstrap 3.0.0+ (w/ tooltip plugin)
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.
Quick Install
Install with pip:
$ pip install django-happenings
Add happenings to INSTALLED_APPS:
INSTALLED_APPS = ( ... 'happenings', )
Include the django-happenings URLconf in urls.py:
url(r'^calendar/', include('happenings.urls', namespace='calendar'))
If your are going to use different namespace then please set CALENDAR_URLS_NAMESPACE in settings
Make sure your TIME_ZONE is set correctly in settings.py.
Run python manage.py migrate to create the models (replace migrate with syncdb happenings if 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 to 127.0.0.1:8000/admin/ to create and manage events.
Check out the calendar at 127.0.0.1:8000/calendar/.
Customizing
The quickest way to begin customizing the app is to override the middle.html template 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>
Locale
There 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 use CALENDAR_LOCALE. The upcoming events list won’t be translated, though. For that you’ll need to specify your LANGUAGE_CODE in the Django settings. Also note that to use CALENDAR_LOCALE you’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 setting CALENDAR_LOCALE also ensures that you’re using the locale you want.
Optional Settings
You can specify different settings for the app in your settings.py file.
Use CALENDAR_URLS_NAMESPACE if you included happenings.urls with namespace other than 'calendar'
Use CALENDAR_COLORS to 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')]
Use CALENDAR_START_DAY to change the day on which the calendar starts. Example of starting the calendar on Sunday (instead of the default of Monday):
CALENDAR_START_DAY = 6
Default time format is “TIME_FORMAT” (user locale dependend if USE_L10N is 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/PM
In 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'
Set CALENDAR_PASS_VIEW_CONTEXT_TO_DISPLAY_METHOD = True to pass context of calendar view to method that renders calendar. Effectively this does not cause any changes to calendar rendering, but this may be useful if you create your own calendar views.
Upgrading from 0.2.X to 0.3.X
Starting 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 sublcassed EventCalendar or MiniEventCalendar calendar then you have 2 options:
subclass LegacyEventCalendar or LegacyMiniEventCalendar. You should also set CALENDAR_LEGACY_TIME_FORMAT in settings.
copy templates/happenings/partials/calendar/*.html` templates to your project templates directory and customize them
If you are using custom CALENDAR_TIME_FORMAT setting then you also have 2 options:
Just remove this setting and use default setting of django TIME_FORMAT.
change it from python strftime notation to Django (PHP) notation. Specifying CALENDAR_HOUR_FORMAT is also a good idea:
# CALENDAR_TIME_FORMAT = '%H:%M' # pre 0.3.1 version CALENDAR_TIME_FORMAT = 'H:i' CALENDAR_HOUR_FORMAT = 'H'
If you used event.l_start_date()/event.l_end_date()/event.start_end_diff() in your code:
They are now cached_properties: use them without brackets or use get_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 using reverse. This may have broken rendering for projects which included happenings.urls in their urlconf with namespace other than "calendar". In such case you have to set CALENDAR_URLS_NAMESPACE in 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 use locale.setlocale and fully utilizes i18n features if django. To set default calendar language you should set LANGUAGE_CODE in settings. If you have enabled language switching for your site then calendar will switch languages too. If you are not using legacy calendars then CALENDAR_LOCALE settings 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.
Tests
Tox is used for testing.
$ pip install tox
$ tox -e py27-django18
More To Come!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for django-happenings-update-0.4.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5716cf0fb1736b63389faf430a0b0fdc3665be230f399ecbbccf7cd81e4bbfe |
|
MD5 | 1627f43e746e91917195b73dc4ac13ca |
|
BLAKE2b-256 | b68d3914f06dd9e29af099033d9cd7d994226695fddb7093029a02675ea91270 |
Hashes for django_happenings_update-0.4.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36f228d5c22fb5fbbbf51a9631d8ebb5a6a1da0e51f14cd0482726176a4042f3 |
|
MD5 | 699f179281a44dc6ea0194dce733b3d7 |
|
BLAKE2b-256 | 5955a9780ee05ca439628184c1af74c7b2a844a3a343d212e1bbd2b4829718b9 |
Hashes for django_happenings_update-0.4.4-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcac0f6d7e966dd49d9951103c1b5432588a375dc3e65dc4a8a40e0b5b8c79cc |
|
MD5 | 718fec3268419878c48bb7f632868c6f |
|
BLAKE2b-256 | 82b8ae5083b2d38c969a1e5de34ab39a285a92422a50eb661a123a233f379c9e |