- Author:
- alaska2008
- Posted:
- March 19, 2015
- Language:
- Python
- Version:
- Not specified
- Score:
- 1 (after 1 ratings)
Adds init and changes passed args to args and *kwargs .
1 2 3 4 5 6 7 8 9 10 11 12 13 | class DecimalObjectValue(ObjectValue):
format = '%0.02f'
def __init__(self, *args, **kwargs):
super(DecimalObjectValue, self).__init__(*args,**kwargs)
def get_object_value(self, *args, **kwargs):
value = super(DecimalObjectValue, self).get_object_value(*args,**kwargs)
if not value:
value = 0
return self.format%value
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 3 months, 1 week ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 3 months, 2 weeks ago
- Serializer factory with Django Rest Framework by julio 10 months, 1 week ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 11 months ago
- Help text hyperlinks by sa2812 11 months, 3 weeks ago
Comments
Please login first before commenting.