Skip to content

mociepka/django-prices

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-prices: Django fields for the prices module

Provides support for models:

from django.db import models

from django_prices.models import PriceField

class Product(models.Model):
    name = models.CharField('Name')
    price = PriceField('Price', currency='BTC')

And forms:

from django import forms

from django_prices.forms import PriceField

class ProductForm(forms.Form):
    name = forms.CharField(label='Name')
    price = PriceField(label='Price', currency='BTC')

And templates:

{% load prices %}

<p>Price: {% gross foo.price %} ({% net foo.price %} + {% tax foo.price %} tax)</p>

Note: for template tags to work, you need to add django_prices to your INSTALLED_APPS.

You can also install the wonderful babel library and get proper currency symbols with prices_i18n. First install BabelDjango:

$ pip install BabelDjango

Then follow the instruction to add it to your INSTALLED_APPS and MIDDLEWARE_CLASSES. Finally load the localized template tags:

{% load prices_i18n %}

<p>Price: {% gross foo.price %} ({% net foo.price %} + {% tax foo.price %} tax)</p>

Batteries included: django-prices comes with South migration support.

About

Django fields for the prices module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%