title: django custom field accept and store decimal but return ouput as integer
body: <p>I have problem statement where I need that my field should store the value as decimal, but while calling it the field should return a rounded Integer value</p>
  
  <p>Example</p>
  
  <blockquote>
    <p>mymodel.myfield = 12.61</p>
    
    <p>mymodel.save()</p>
  </blockquote>
  
  <p>Input</p>
  
  <blockquote>
    <p>mymodel.myfield</p>
  </blockquote>
  
  <p>Output</p>
  
  <blockquote>
    <p>13</p>
  </blockquote>
  
  <p>and if it is possible</p>
  
  <blockquote>
    <p>mymodel.myfield.get_raw</p>
  </blockquote>
  
  <p>Output</p>
  
  <blockquote>
    <p>12.61</p>
  </blockquote>
  
  <p>Can I use django custom model field?</p>
  
  <pre><code>class MyField(models.DecimalField):
  
      def __init__(self, verbose_name=None, name=None, max_digits=None,
                   decimal_places=None, **kwargs):
          super(MyField, self).__init__(*args, **kwargs)
  
      def get_raw(self, value):
          return value
  
      def to_python(self, value):
          if value is None:
              return value
          try:
              return decimal.Decimal(value)
          except decimal.InvalidOperation:
              raise exceptions.ValidationError(
                  self.error_messages['invalid'],
                  code='invalid',
                  params={'value': value},
              )
  </code></pre>