title: Django: Computing new attribute before serving data as GeoJSON
body: <p>I have a dataset of point locations (in this example, schools). Before serving this data as GeoJSON, I'd like to compute polygonal buffers around the points, and add those as an attribute.</p>
  <p>I know that I can use <code>django.core.serializers.serialize</code> to convert a QuerySet into the GeoJSON format that I need. I also know how to calculate the buffer (<code>self.geometry.buffer</code>), I just can't figure out how to string this all together.</p>
  <p><strong>models.py</strong></p>
  <pre><code>from django.contrib.gis.db import models
  
  class School(models.Model):
  
      name = models.CharField(max_length=50)
      geometry = models.PointField()
  
      def compute_buffer(self, radius):
          self.buffer = self.geometry.buffer(radius)
  </code></pre>
  <p><strong>views.py</strong></p>
  <pre><code>from django.core.serializers import serialize
  
  def data(request):
  
      geom_as_geojson = serialize('geojson', School.objects.all())
      return HttpResponse(geom_as_geojson, content_type='json')
  </code></pre>