title: Can a Django ModelForm display a custom representation of stored values?
body: <p>In my model, percentage data is stored as fractional values in the 0.0-1.0 range. Because they are percentages, I want the user to view and edit the values in the 0.0-100.0 range.</p>
  
  <p>What is the preferred way of transforming data between its <strong>stored value</strong> and the <strong>displayed value</strong>? Note that the format depends on another instance variable.</p>
  
  <p>My model looks like this:</p>
  
  <pre><code>class MyModel(models.Model):
      format = models.CharField(choices=(('percentage', 'Percentage'), ('absolute', 'Absolute'))
      my_value = models.FloatField()
  
      def _get_my_value_display(self):
          if self.format == 'percentage':
              return self.my_value * 100
          else:
              return self.my_value
  
      def _set_my_value_display(self, v):
          if self.format == 'percentage':
              return v / 100
          else:
              return self.my_value
  
      my_value_display = property(_get_my_value, _set_my_value)
  </code></pre>
  
  <p>In the form, I tried to use the display property as a form field, but that doesn't work (Unknown field(s) (my_value_display) specified for MyModel):</p>
  
  <pre><code>class MyForm(forms.ModelForm):
  
      class Meta:
          model = MyModel
          fields = ('my_value_display', )
  </code></pre>