creditcards Package

models Module

class creditcards.models.CreditCard(*args, **kwargs)[source]

A Communard-Visible Wrapper for an Account.

account

The Account the CreditCard is linked to. This is the Account that will be credited when CreditCardEntries are approved.

name

A name for the Credit Card, used in forms accessible by Communards.

class creditcards.models.CreditCardEntry(*args, **kwargs)[source]

Communard entries used as a pre-approval state for JournalEntries.

These are used to group together CreditCardTransactions before the Entry is approved by an Accountant.

When approved, the CreditCardEntry massages it’s data into a JournalEntry and Transactions so that the relevant Account balances are modified, then deletes itself.

date

The date the entry occured.

card

The CreditCard the entry belongs too.

name

The name of the communard who submitted the entry.

merchant

The name of the merchant the purchase was made at.

amount

The total amount of money spent. This is balanced against related CreditCardTransactions.

comments

Additional comments from the Communard.

created_at

The date & time the Entry was created.

approve_entry()[source]

Creating a JournalEntry Transactions and Receipts from the Entry.

This does not delete the entry, as should be done when an Entry is approved. You must manually delete the CreditCardEntry.

Returns the created JournalEntry.

generate_memo()[source]

Create a memo line from the Entry’s attributes.

get_edit_url()[source]

Return an edit link to the Entry’s edit page.

get_next_entry()[source]

Return a Queryset of the next possible Entries to display.

get_number()[source]

Generate an Entry number using the id.

class creditcards.models.CreditCardReceipt(*args, **kwargs)[source]

Stores Receipts for an unapproved CreditCardEntry.

When the CreditCardEntry is approved, these are turned into receipts.models.Receipts.

receipt_file

The actual receipt stored as a file.

creditcard_entry

The CreditCardEntry this receipt bleongs to.

class creditcards.models.CreditCardTransaction(*args, **kwargs)[source]

Represents the individual charges for a CreditCardEntry.

Unlike a entries.models.Transaction, a CreditCardTransaction does not affect the balance of it’s entries.models.Account.

creditcard_entry

The CreditCardEntry the CreditCardTransaction belongs to

account

The related accounts.models.Account.

detail

Information about the specific charge.

balance_delta

The change in balance this Transaction represents. A positive value indicates a Credit while a negative value is a Debit.

admin Module

forms Module

class creditcards.forms.CreditCardEntryForm(*args, **kwargs)[source]

A Form for CreditCardEntries along with multiple CreditCardReceipts.

views Module

class creditcards.views.AddCreditCardEntry[source]

Customize the generic AddApprovableEntryView for CreditCardEntries.

entry_class

alias of CreditCardEntry

entry_form_class

alias of CreditCardEntryForm

receipt_class

alias of CreditCardReceipt

creditcards.views.add_creditcard_entry(request, entry_id=None, template_name='creditcards/credit_card_form.html')[source]

Add, edit, approve or delete a CreditCardEntry.

creditcards.views.list_creditcard_entries(request, *args, **kwargs)[source]

Retrieve every CreditCardEntry.

creditcards.views.show_creditcard_entry(request, entry_id, template_name='creditcards/show_entry.html')[source]

View a CreditCardEntry.