title: 'Friend' has no attribute 'META' error unknown reason - django
body: <p>I have a view and template that create queries that search through objects in the database. I also have lists that will create a list of usernames based on different querysets. 
  I pass the searched queryset and two lists which are pending and friends. I then check to see if the usernames in the search query are located in the list. if they in the list it will display a different message depending on the list it is located in. if it is not located in any list, it will display a different message.</p>
  
  <p>error + trace:</p>
  
  <pre><code>AttributeError at /search/
  'Friend' object has no attribute 'META'
  Request Method: POST
  Request URL:    http://127.0.0.1:8000/search/
  Django Version: 2.0.5
  Exception Type: AttributeError
  Exception Value:    
  'Friend' object has no attribute 'META'
  Exception Location: /Users/omarjandali/anaconda3/envs/MySplit/lib/python3.6/site-packages/django/template/context_processors.py in debug, line 40
  Python Executable:  /Users/omarjandali/anaconda3/envs/MySplit/bin/python
  Python Version: 3.6.2
  Python Path:    
  ['/Users/omarjandali/Desktop/mysplit/mysplit',
   '/Users/omarjandali/anaconda3/envs/MySplit/lib/python36.zip',
   '/Users/omarjandali/anaconda3/envs/MySplit/lib/python3.6',
   '/Users/omarjandali/anaconda3/envs/MySplit/lib/python3.6/lib-dynload',
   '/Users/omarjandali/anaconda3/envs/MySplit/lib/python3.6/site-packages']
  </code></pre>
  
  <p>here is the code:</p>
  
  <pre><code>if request.method == "POST":
          search = request.POST['search']
          searched = User.objects.filter(username__contains = search).all()
          searched |= User.objects.filter(first_name__contains = search).all()
          searched |= User.objects.filter(last_name__contains = search).all()
          requester = Friend.objects.filter(user = user).filter(requested = True).all()
          requested = Friend.objects.filter(friend = user.username).filter(requested = True).all()
          friended = Friend.objects.filter(user = user).filter(accepted = True).all()
          friender = Friend.objects.filter(friend = user.username).filter(accepted = True).all()
          pending = []
          for request in requester:
              pending.append(request.friend)
          for request in requested:
              pending.append(request.user.username)
          print(pending)
          friends = []
          for friend in friended:
              friends.append(friend.friend)
          for friend in friender:
              friends.append(friend.user.username)
          print(friends)
          parameters = {
              'user':user,
              'searched':searched,
              'friends':friends,
              'pending':pending,
          }
          return render(request, 'users/user_search.html', parameters)
  </code></pre>
  
  <p>Here is the tempalte:</p>
  
  <pre><code>{% for search in searched %}
    {% if search.username != user.username %}
      &lt;p&gt;
      &lt;a href="{% url 'view_profile' username=search.username %}"&gt;{{ search.username }}&lt;/a&gt;
      {% if search.username in pending %}
        Pending
      {% elif search.username in friends %}
        Friends
      {% else %}
        &lt;a href="{% url 'send_request' username=search.username %}"&gt;Send Request&lt;/a&gt;
      {% endif %}
      &lt;/p&gt;
    {% endif %}
  {% endfor %}
  </code></pre>