title: Python/Django: RelatedObjectDoesNotExist: Cart has no user
body: <p>I have 3 tables in my database. <code>User</code>, <code>Flower</code>, and <code>Cart</code>. I am trying create a shopping cart experience for a user where the user logs on, gets a shopping cart, can add things to their cart, and subsequently order things from their cart. </p>
  
  <p>My <code>Cart</code> has a <code>ManyToManyField(Flower)</code> and my <code>User</code> has a <code>OneToOneField(Cart)</code>. When the user adds something to their cart I need to create a cart for them, and then store their user id and the flower id (or name) that they clicked to add to their cart. </p>
  
  <p>Currently this is the sequence I am going through... </p>
  
  <p>1) Grab the user from the database via <code>p1 = User.objects.filter(username = 'erik')</code> </p>
  
  <p>2) Grab the user object out of the list <code>p1 = [0]</code></p>
  
  <p>3) <code>c1 = Cart(id = 1)</code></p>
  
  <p>4) <code>c1.user.add(p1)</code></p>
  
  <p>I am getting the following error: <code>RelatedObjectDoesNotExist: Cart has no user.</code></p>
  
  <p>Why is this not working and how can I get it to do what I need it to do? </p>
  
  <p><strong><em>My Model...</em></strong></p>
  
  <pre><code>from __future__ import unicode_literals
  from django.contrib.auth.models import User
  from django.db import models
  
  class Flower(models.Model):
      name = models.CharField(max_length=255)
      link = models.CharField(max_length=255)
      created_at = models.DateField(auto_now_add=True)
  
      def __str__(self):
          return self.name
  class Meta:
      db_table = 'Flower'
  
  class Cart(models.Model): 
      userid = models.CharField(max_length=255)
      flowername = models.CharField(max_length=255) 
      user = models.OneToOneField(User)
      flower = models.ManyToManyField(Flower)
  </code></pre>