Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A Django template-tag for fortunes.

Project description

django-fortune

A Django template-tag that provides a fortune.

The Template Tag

{% load fortune_tags %}
{% fortune %}

The Management Commands

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

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

The Python Interface

$ python manage.py 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.'
>>>

Installation

Install using pip;

$ pip install django-fortune

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

Project details


Release history Release notifications

This version
History Node

1.1.1

History Node

1.1.0

History Node

1.0.6

History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

History Node

1.0

History Node

1.0b

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-fortune-1.1.1.tar.gz (1.0 MB) Copy SHA256 hash SHA256 Source None Mar 13, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page