Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A Django template-tag for fortunes.

Project description


A Django template-tag that provides a fortune.

The Template Tag

{% load fortune_tags %}
{% fortune %}

The Management Commands

$ python fortune  # Get a fortune.
Fortunes will improve after loading some.  # Oops, no fortunes loaded.
$ python fortune_list_packs  # List available fortune packs.
-- Installed: --
-- Available: --
$ python fortune_load_pack art  # Load art fortunes.
$ python fortune  # Get an art fortune.

"My life is a soap opera, but who has the rights?"
        -- Madame
$ python fortune_unload_pack art  # Unload art fortunes.
$ python fortune  # No fortunes available again. :-(
Fortunes will improve after loading some.

The Python Interface

$ python shell
>>> from fortune.models import Fortune, Pack
>>> Fortune.fortune()
'Fortunes will improve after loading some.'
>>> from fortune import utils
>>> fortunes_path = utils.get_fortunes_path()
>>> art_fortunes_path = fortunes.path.joinpath("art")
>>> Pack.load(str(art_fortunes_path))
>>> Fortune.fortune()
u"\nThey can't stop us... we're on a mission from God!\n\t\t-- The Blues Brother"
>>> art_fortunes = Pack.objects.get(name="art".title())
>>> art_fortunes.unload()
>>> Fortune.fortune()
'Fortunes will improve after loading some.'


Install using pip;

$ pip install django-fortune

then add “fortune” to INSTALLED_APPS in your app’s

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-fortune, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django-fortune-1.1.1.tar.gz (1.0 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page