Snippet List
This code publishes an iCal file that can be subscribed to in Google Calendar. They change the way they interpret iCal data occasionally, so this may break, I'll try to keep it up to date.
There is some crazy string replace stuff going on there, I haven't yet convinced vObject to format things properly.
Feedback welcome.
*Note: this works for my existing feeds, but if I add a new feed to GCal, the timezones are incorrect, I'm working on that.
- calendar
- timezone
- google
- publish
- ical
- subscribe
I wanted a simple way to display events for a given month in a calendar, so I adapted some code to write a template tag. `Event` is the model class, and it needs to have a `date_and_time` field. Each event is part of a `Series`, so in the view you can filter events by which series, or display events for all known Series.
[Full explanation and description of simple Django event calendar template tag](http://williamjohnbert.com/2011/06/django-event-calendar-for-a-django-beginner/).
- calendar
- event-calendar
- htmlcalendar
Adds filtering by ranges of dates in the admin filter sidebar.
[https://github.com/coolchevy/django-datefilterspec](https://github.com/coolchevy/django-datefilterspec)
[http://coolchevy.org.ua](http://coolchevy.org.ua)
https://github.com/coolchevy/django-datefilterspec/raw/master/datefilter.png
Example:
`
from django.db import models
import datefilterspec
class Person(models.Model):
date = models.DateTimeField(default=datetime.datetime.now)
date.date_filter = True
class Admin:
list_filter = ['date']
- filter
- admin
- date
- calendar
- sidebar
- filterspec
This is a fairly straightforward view to generate iCalendar (.ics) files, with a unique UUID, a proper filename, and the basic fields needed to export an event from a public calendar (using the django-events-calendar app). While it can certainly be extended and adapted, it works very well as-is.
This is a simple calendar widget in Django 1.2 for Jalali Calendar usages. It actually sends a Gregorian value to server, so if you need further manipulations, you can use [GNU Jalali Calendar](http://home.gna.org/jalali-calendar/). You should also have [JalaliJSCalendar](http://farhadi.ir/works/jalalijscalendar) set up in your project.
Also posted on: [Django Jalali Calendar Widget](http://texscribbles.blogspot.com/2010/06/django-jalali-calendar-widget.html)
- calendar
- widget
- jalali
- farsi
- persian
DateTimeWidget using [JSCal2](http://www.dynarch.com/projects/calendar/)
Duplicate of [this snippet](http://www.djangosnippets.org/snippets/391/), but for latest 1.5 version of DHTML Calendar.
Also here is **fixed problem of previous widget** linked to *form.changed_data* and *EntryLog.message*. This is fixed by adding own, little modified *_has_changed()* method
- datetime
- date
- calendar
- widget
- dhtml
This tag gives you an iterable Python [Calendar object](http://docs.python.org/library/calendar.html) in your template namespace. It is used in the [django-calendar](http://github.com/dokterbob/django-agenda) project.
Use it as follows in your template:
{% get_calendar for <month_number_or_variable> <year_or_variable> as calendar %}
<table>
<tr>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
<th>Sun</th>
</tr>
{% for week in calendar %}
<tr>
{% for day in week %}
<td>{{ day.day }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
- template
- tag
- date
- calendar
Creates a filter for displaying calendars.
Passed value is a dict of dicts of arrays: that is, indexed by year, then by month. The list of month days is used to generate links in the format specified by the argument. If a particular day is *not* in the list, then no link will be generated and it will just display a number for that day.
**EXAMPLE**
`{{ calendar|calendar_table:"/schedules/calendar/[Y]-[m]-[d]/" }}`
This widget uses: [DHTML Calendar Widget](http://www.dynarch.com/projects/calendar/).
It is very simple implementation but may be easily extended/changed/refined.
1. Necessary files:
First download calendar package and extract it to your MEDIA folder (MEDIA/calendar/...)
You'll also need a small gif that will be shown as a button that allows user to display calendar. By default this 'gif' is searched at '[MEDIA]images/calbutton.gif' but you may change this path in the code (calbtn variable). You need to download or create callbutton.gif image by yourself (it is not included).
2. Include css and js files in your page (as shown in the comment in the code).
3. In form code assign a widget to a field as usual (see newforms documentation for more details).
4. It is possible to change date format by specifying different value for 'dformat' attribute of widget class.
If you get javascript errors while trying to open calendar try to use english translation file (calendar-en.js). I've found that some translations, eg. Polish, are broken by default. In this case you should override your language translation with english one and translate it by yourself (it is easy).
- datetime
- date
- calendar
- widget
- dhtml
13 snippets posted so far.