Login

Geraldo Reports Currency class update for DecimalObjectValue

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

  1. Template tag - list punctuation for a list of items by shapiromatron 10 months, 2 weeks ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 3 weeks ago
  3. Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
  5. Help text hyperlinks by sa2812 1 year, 6 months ago

Comments

Please login first before commenting.