Manual
Almnck.
Price: 50ⓐ

Date Events Database Design

An internal database of historical, recurring, and future events for editorial planning.

Data Model

New Django app events with a single model:

class DateEvent(models.Model):
    # The date (stored as string to handle BCE years, matching almanac-day format)
    event_date = models.CharField(max_length=20)  # "2024-02-12" or "-4000-01-01"

    # Denormalized for querying "on this day"
    month = models.PositiveSmallIntegerField()  # 1-12
    day = models.PositiveSmallIntegerField()    # 1-31

    # Content
    title = models.CharField(max_length=300)
    description = models.TextField(blank=True)
    notes = models.TextField(blank=True)  # Sources, URLs, citations, whatever
    tags = models.JSONField(default=list)

    # Optional link to article
    article = models.ForeignKey(
        'units.Unit',
        null=True, blank=True,
        on_delete=models.SET_NULL,
        related_name='events'
    )

The month and day fields are denormalized on save for fast “on this day” queries without string parsing.

Django Admin

Primary editing interface:

@admin.register(DateEvent)
class DateEventAdmin(admin.ModelAdmin):
    list_display = ['event_date', 'title', 'article', 'tag_list']
    list_filter = ['month', 'tags']
    search_fields = ['title', 'description', 'notes']
    autocomplete_fields = ['article']

Views: - Default list with search and filters - Month filter for editorial planning - “On this day” shows events matching today’s month-day

Action: “Create stub article” prompts for title and optional slug, then creates editorial/inbox/{slug}/article.md.

CLI: a-date

Add Events

# Positional arguments: title, date, notes (optional), tags (optional)
a-date "Birth of Zephram Cochrane" "2032-04-05" "Star Trek Reference Guide" "fiction,trek"

# JSON object
a-date --json '{"title": "...", "event_date": "...", "notes": "...", "tags": ["fiction"]}'

# JSON array for bulk import
a-date --json '[{"title": "...", ...}, {"title": "...", ...}]'

# Pipe-friendly
echo '[...]' | a-date --json -

Outputs created event ID on success.

Export

# Dump all events in futures.md format
a-date --dump

# Dump with age encryption (using editors key)
a-date --dump --encrypt

# Filter by month or tag
a-date --dump --month=2
a-date --dump --tag=fiction

Output format:

---
description: future articles! sssh!
age-encrypt: yes
age-recipients:
  - git:assets/keys/editors
---

# Events Database Export

1809-02-12 : Charles Darwin born
1847-02-11 : Thomas Edison born : https://en.wikipedia.org/wiki/Thomas_Edison [science,biography]
2032-04-05 : Birth of Zephram Cochrane : Star Trek Reference Guide [fiction,trek]

Events linked to the same article are grouped with footnote-style references.

Create Stub Articles

# Create stub from event (title required)
a-date --stub 42 --title="The Beagle's Most Famous Passenger"

# Combine multiple events into one stub
a-date --stub 42,43 --title="Two Naturalists" --slug="darwin-lincoln"

Creates editorial/inbox/{slug}/article.md with frontmatter and notes from the linked events.

Not Included (YAGNI)

  • Calendar UI (admin list view suffices)
  • Recurrence rules (implicit in month-day queries)
  • Time-of-day precision
  • Separate category field (tags cover it)