title: How to order a list in django with name?
body: <p>Here I tried like this but it is not giving me the correct ordering.</p>
  <pre><code>class VAttribute(models.Model):
     attribute = models.ForeignKey(PAttribute, on_delete=models.CASCADE)
  ....
  
  class PAttribute(models.Model):
      name = models.CharField(max_length=255, unique=True)
  
  from operator import attrgetter
  qs = VAttribute.objects.all()
  ls = [obj.attribute for obj in qs]
  #ls = [&lt;PAttribute: name1&gt;, &lt;PAttribute: nam2&gt;]
  
  ordered_ls = sorted(ls, key=attrgetter('name'))
  </code></pre>