Coverage for /home/tribaal/workspace/django-shop/shop/util/fields: 100.00%

# Coverage for /home/tribaal/workspace/django-shop/shop/util/fields : 100.00%

## 7 statements 7 run 0 missing 6 excluded 0 partial

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # -*- coding: utf-8 -*- from decimal import Decimal from django.db.models.fields import DecimalField class CurrencyField(DecimalField): """ A CurrencyField is simply a subclass of DecimalField with a fixed format: max_digits = 30, decimal_places=10, and defaults to 0.00 """ def __init__(self, **kwargs): defaults = { 'max_digits': 30, 'decimal_places': 2, 'default': Decimal('0.0') } defaults.update(kwargs) super(CurrencyField, self).__init__(**defaults) def south_field_triple(self): # pragma: no cover """ Returns a suitable description of this field for South. This is excluded from coverage reports since it is pretty much a piece of South itself, and does not influence program behavior at all in case we don't use South. """ # We'll just introspect the _actual_ field. from south.modelsinspector import introspector field_class = "django.db.models.fields.DecimalField" args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs)