title: django get distinct value from queryset
body: <p>I have a model:</p>
  
  <pre><code>class Organisation(User):
      organisation_name = models.CharField(max_length=200)
      first_parent = models.ForeignKey('Parent', related_name="first", blank=True, null=True)
      second_parent = models.ForeignKey('Parent', related_name="second", blank=True, null=True)
  
  
  
      def __unicode__(self):
          return self.username
  </code></pre>
  
  <p>and my Parent model:</p>
  
  <pre><code>class Parent(models.Model):
      parent_name = models.CharField(max_length=50)
  
      def __unicode__(self):
          return self.parent_name
  </code></pre>
  
  <p>Here I want the list of parents in my templates that are unique. I dont want repeted parents.</p>
  
  <p>I have gone through:</p>
  
  <pre><code>organisations = Organisation.objects.all().distinct('first_parent')
  </code></pre>
  
  <p>but this is not supported by mysql.</p>
  
  <p>I tried to get list of first parents from organisations then its set gives only unique value like:</p>
  
  <pre><code>organisations = Organisation.objects.all()
  parent_list = organisations.first_parent ## it gives error says 'QuerySet' object has no attribute 'first_parent'
  </code></pre>
  
  <p>I have thought about grouping in template but i was not able to.. </p>
  
  <p>What I want is list of first_parent or organisation with its id in template so that I can redirect it to some page with id like</p>
  
  <pre><code>{% for parent in parent_list %}
      {{parent}}
      &lt;a href="{% url "some_url" parent.id %}"
  </code></pre>
  
  <p>first_parent I get should be unique.</p>
  
  <p>How can I get this. please help</p>