Skip to main content
https://img.shields.io/pypi/v/django_recurring.svg https://img.shields.io/travis/boosh/django_recurring.svg Documentation Status

Create ical-compatible calendar events in django. This library is good if you need:

  • iCal-compatible calendar entries with multiple events and (optionally) complex recurrence rules and multiple exclusions

  • Calendar entries you can export to iCal format (.ics files)

  • To add complex recurrence rules (i.e. repeating events) to your models and interact with them as dateutil rrulesets

Free software: MIT license

Status

Initial release. There are likely to be bugs.

The 0.x series is for development only and should not be used in live projects. Semver is ignored on the 0.x branch.

Features

  • Create calendar entries/schedules with multiple events, recurrence rules and exclusions
    • E.g. Every Monday in Jan & Feb, every Tuesday in Mar and Apr, except the 3rd weeks of Feb and Apr.

  • Access recurrences using dateutil rrulesets

  • Automatically calculate previous and next occurrences for efficient date range queries

  • Timezone-aware datetime handling

  • Export to iCal format (.ics files)

  • Admin widget for creating and editing recurrence patterns

Quick Start

  1. Install django-recurring:

    pip install django-recurring
  2. Add ‘recurring’ to your INSTALLED_APPS:

    INSTALLED_APPS = [
        ...
        'recurring',
    ]
  3. Run migrations:

    python manage.py migrate recurring
  4. Add CalendarEntry to your model:

    For a calendar entry with multiple events:

    from django.db import models
    from recurring.models import CalendarEntry
    
    class Meeting(models.Model):
        name = models.CharField(max_length=200)
        calendar = models.ForeignKey(CalendarEntry, on_delete=models.CASCADE)
  5. Use CalendarEntry in your code:

    from django.utils import timezone
    from recurring.models import CalendarEntry, Event, RecurrenceRule, Timezone, MONDAY
    
    # Create a CalendarEntry with multiple events
    calendar = CalendarEntry.objects.create(
        name="Team Meetings",
        timezone=Timezone.objects.get(name="UTC")
    )
    
    weekly_rule = RecurrenceRule.objects.create(
        frequency=RecurrenceRule.Frequency.WEEKLY,
        interval=1,
        byweekday=[MONDAY]
    )
    
    Event.objects.create(
        calendar_entry=calendar,
        start_time=timezone.now(),
        end_time=timezone.now() + timezone.timedelta(hours=1),
        recurrence_rule=weekly_rule
    )
    
    # Create a single recurring event
    monthly_rule = RecurrenceRule.objects.create(
        frequency=RecurrenceRule.Frequency.MONTHLY,
        interval=1,
        bysetpos=[1],
        byweekday=[MONDAY]
    )
    
    task = Event.objects.create(
        start_time=timezone.now(),
        end_time=timezone.now() + timezone.timedelta(hours=2),
        recurrence_rule=monthly_rule
    )
    
    # automatically recalculate occurrences now there are some
    # events and recurrence rules
    calendar.save()
    
    # Query upcoming meetings
    upcoming_meetings = Meeting.objects.filter(
        calendar__next_occurrence__gte=timezone.now(),
        calendar__next_occurrence__lte=timezone.now() + timezone.timedelta(days=30)
    )
    
    # Query upcoming tasks
    upcoming_tasks = Task.objects.filter(
        schedule__start_time__gte=timezone.now(),
        schedule__start_time__lte=timezone.now() + timezone.timedelta(days=30)
    )
  6. Export to iCal format:

    ical_string = calendar.to_ical()
    with open('team_meetings.ics', 'w') as f:
        f.write(ical_string)

For more detailed usage and examples, see the documentation.

Why?

django-recurrence lacks multiple features (e.g. times, hourly intervals, etc) that don’t seem possible to solve. A new library was in order.

Metadata

Release files for django-recurring 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-recurring 1.3.3
File Size Uploaded Provenance
django_recurring-1.3.3.tar.gz 1.1 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-recurring 1.3.3
File Interpreter ABI Platform
django_recurring-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / django_recurring-1.3.3.tar.gz

Download URL django_recurring-1.3.3.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
c91a2311396183b5212ba666e3738a9746bede91b297eb830736c18aaefd3491
BLAKE2b-256 checksum
How to use checksums
1b6478a6cb843fedfe818883498f493ebb83b7df56aaf3f88a33b2cdee9ee0ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / django_recurring-1.3.3-py3-none-any.whl

Download URL django_recurring-1.3.3-py3-none-any.whl
Size 52.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ce0082c02bb3c7d084e2374330a54e43ba8823f9f1db61b37e70af986165130
BLAKE2b-256 checksum
How to use checksums
6758081008c7807d7405f6a0ed92057cfd544702abfb85a9b56d221cb14a3b9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for django-recurring 1.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page