Skip to main content

A double-entry bookkeeping module for django

Project description

A double-entry bookkeeping system originally developed for SwingTix.

Hello, World

You’ll need a django project. If you don’t have one handy, you can make an empty one following the first steps of the django tutorial. Afterwards, edit <yourproject>/settings.py to add “swingtix.bookkeeper” to INSTALLED_APPS and run:

$ python manage.py syncdb

Then you’re ready to start exploring using the shell:

$ python manage.py shell

First, let’s create a couple of accounts:

>>> from swingtix.bookkeeper.models import BookSet, Account

>>> book = BookSet(description="my book")
>>> book.save()

>>> revenue  = Account(bookset=book, name="revenue", positive_credit=True)
>>> revenue.save()
>>> bank     = Account(bookset=book, name="bank",    positive_credit=False)
>>> bank.save()
>>> expense  = Account(bookset=book, name="expense", positive_credit=False)
>>> expense.save()

Then you can use them:

>>> book = BookSet.objects.get(description="my book")
>>> revenue = book.get_account("revenue")
>>> bank    = book.get_account("bank")
>>> expense = book.get_account("expense")

#Someone pays you can advance.  Yay!
>>> bank.debit(120.00, revenue, "our first sale")
(<AccountEntry: 120 >, <AccountEntry: -120 >)

#but now you have to do some work.  The local coffee shop has free wifi..
>>> bank.credit(2.20, expense, "coffee")
(<AccountEntry: -2 >, <AccountEntry: 2 >)

>>> bank.balance()
Decimal('117.80')
>>> expense.balance()
Decimal('2.20')
>>> revenue.balance()
Decimal('120.00')

Project details


Download files

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

Source Distribution

swingtix-bookkeeper-0.0.6.tar.gz (26.0 kB view details)

Uploaded Source

File details

Details for the file swingtix-bookkeeper-0.0.6.tar.gz.

File metadata

File hashes

Hashes for swingtix-bookkeeper-0.0.6.tar.gz
Algorithm Hash digest
SHA256 d875f3ae4a5e2bcb4c9ec16ea052106d0dc6eaf55781b04252b5df8777f58c48
MD5 9b70e3dba0e2a3fc135dc4bafd19e1f1
BLAKE2b-256 a3c243fb0c50c7acc28e9ebc51b2bab057ac3def24a8ef6f88236a1e54b262bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page