title: Django - get dict from TextField
body: <p>I want to store a dict in Django.
  a very basic solution would be this:</p>
  
  <pre><code>class foo(models.Model):
      bar = models.TextField()
  
  fooInstance.bar = json.dumps(my_dict)
  </code></pre>
  
  <p>but I wanted to be able to access it directly and not constantly use json, so I did the following:</p>
  
  <pre><code>class foo(models.Model):
      _bar = models.TextField()
  
      @property
      def bar(self):
          import json
          return json.loads(self._bar)
  
      @bar.setter
      def bar(self, new_bar):
          import json
          self._bar = json.dumps(new_bar)
  
  fooInstance.bar = my_dict
  </code></pre>
  
  <p>and this works for the most part, only that I can't do one thing:</p>
  
  <pre><code>fooInstance.bar['key'] = 'value'
  </code></pre>
  
  <p>this expression goes through, no error. but the value is not being set.
  does anybody has any ideas on how this could be done?</p>
  
  <p>Any help is appreciated.</p>