title: Access fields in Django
body: <p>The problem is, when i'm trying to compare two properties which are the same when we check them in shell, but the condition is not complete and i have no idea why. I mean this condition: {% if c.author = member.name %}</p>
  
  <p>views:</p>
  
  <pre><code>    cvs = Cv.objects.all()
      cv = Cv.objects.filter(author = request.user)
      per = Person.objects.all()
      gr = Group.objects.filter(members__name=request.user)
  
      for c in cvs:
          print c.author
  
      mem = Membership.objects.all()
      form = GroupForm()
  
  
      context = {
          'gr': gr,
          'per':per,
          'mem':mem,
          'form': form,
          'cvs':cvs,
          'cv':cv,
      }
  
      return render(request, 'groups.html', context)
  </code></pre>
  
  <p>models.py:</p>
  
  <pre><code>class Cv(models.Model):
      author = models.ForeignKey('auth.User')
      name = models.CharField(max_length=25, null = True)
      surname = models.CharField(max_length=25, null = True)
      address = models.CharField(max_length=100, blank=True)
      telephone = models.IntegerField()
      birth_date = models.DateField(blank=True, null=True)
      email = models.EmailField(max_length=50, null=True)
      skills = models.TextField(null=True)
      specialization = models.CharField(max_length=30, blank=True, null=True)
      interests = models.TextField(blank=True, null=True)
      summary = models.TextField(blank=True, null=True)
      thumbnail = models.FileField(upload_to=get_upload_file_name, blank=True)
  
  
      @property
      def age(self):
          return int((datetime.datetime.now().date() - self.birth_date).days / 365.25 )
  
      def zapisz(self):
          self.save()
  
      def __str__(self):
          return self.surname
  
  
  
  
  class Person(models.Model):
      name = models.CharField(max_length=128)
  
      def __str__(self):              # __unicode__ on Python 2
          return self.name
  
  
  class Group(models.Model):
      name = models.CharField(max_length=128)
      members = models.ManyToManyField(Person, through='Membership')
  
       def __str__(self):              # __unicode__ on Python 2
          return self.name
  
  
  class Membership(models.Model):
      person = models.ForeignKey(Person)
      leader = models.BooleanField(default=False)
      group = models.ForeignKey(Group)
  </code></pre>
  
  <p>groups.html:</p>
  
  <pre><code>{% block profile %}
  
  
        {% for g in gr %}
          &lt;div class="jumbotron"&gt;
            &lt;p&gt;&lt;b&gt;GROUP:&lt;/b&gt; {{g.name}}&lt;/p&gt;
            {% for c in cvs %}
              {% for member in g.members.all %}
                {% if c.author = member.name %}
                  {{member.name}}
                {% endif %}
              {% endfor %}
            {% endfor %}
          &lt;/div&gt;
        {% endfor %}
  
  
  
  {% endblock %}
  </code></pre>
  
  <p>Thanks for answer!</p>