title: Display purchase history from Django Admin
body: <p><a href="https://i.stack.imgur.com/ogjMQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ogjMQ.png" alt="enter image description here"></a>I am trying to show the purchase history per user on the each users dashboard. I have made some dummy orders in Stripe which are working but I am having difficulty displaying the orders in the order history section of the page.</p>
  
  <p>I am also not sure the order is linking correctly to the registered user in the first place as I seem to be confusing myself with this method</p>
  
  <p>Can somebody help me or point me in the right direction please? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-sm-12 col-md-12 col-lg-12"&gt;
           
      &lt;table class="table table-striped"&gt;
      &lt;h3&gt;Your order history&lt;/h3&gt;
      &lt;hr&gt;
      
    &lt;tr&gt;
      &lt;th&gt;Date&lt;/th&gt;
      &lt;th&gt;Invoice ID&lt;/th&gt; 
      &lt;th&gt;Description&lt;/th&gt;
      &lt;th&gt;Total&lt;/th&gt;
    &lt;/tr&gt;
    {% for orders in orders %}
    &lt;tr&gt;
      &lt;td scope="row"&gt;{{ order.quantity }}&lt;/td&gt;
      &lt;td&gt;xxx&lt;/td&gt;
      &lt;td&gt;xxx&lt;/td&gt;
      &lt;td&gt;xxx&lt;/td&gt;
    &lt;/tr&gt;
    {% endfor %}
  
  &lt;/table&gt;
    
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>My checkout views.py</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>from django.contrib import messages, auth
  from django.contrib.auth.decorators import login_required
  from checkout.forms import MakePaymentForm
  from django.shortcuts import render, get_object_or_404, redirect, reverse
  from django.template.context_processors import csrf
  from django.conf import settings
  from babysitters.models import Babysitter
  import stripe
  
  # stripe.api_key = settings.STRIPE_SECRET
  
  
  @login_required(login_url="/accounts/login")
  def buy_now(request, id):
      if request.method == 'POST':
          form = MakePaymentForm(request.POST)
          if form.is_valid():
              try:
                  babysitter = get_object_or_404(Babysitter, pk=id)
                  customer = stripe.Charge.create(
                      amount= int(babysitter.price * 100),
                      currency="EUR",
                      description=babysitter.firstName,
                      card=form.cleaned_data['stripe_id'],
                  )
              except (stripe.error.CardError):
                  messages.error(request, "Your card was declined!")
  
              if customer.paid:
                  messages.success(request, "You have successfully paid")
                  return redirect(reverse('babysitters'))
              else:
                  messages.error(request, "Unable to take payment")
          else:
              messages.error(request, "We were unable to take a payment with that card!")
  
      else:
          form = MakePaymentForm()
          babysitter = get_object_or_404(Babysitter, pk=id)
  
      args = {'form': form, 'publishable': settings.STRIPE_PUBLISHABLE, 'babysitter': babysitter}
      args.update(csrf(request))
  
      return render(request, 'checkout.html', args)</code></pre>
  </div>
  </div>
  </p>
  
  <p>My Models.py file </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>from django.db import models
  from babysitters.models import Babysitter
  from django.contrib.auth.models import User
  
  # Create your models here.
  
  class Order(models.Model):
      first_name = models.CharField(max_length=255, blank=True)
      last_name = models.CharField(max_length=255, blank=True)
      address1 = models.CharField(max_length=255, blank=True)
      address2 = models.CharField(max_length=255, blank=True)
      city = models.CharField(max_length=20, null=True)
      county = models.CharField(max_length=100, null=True)
      postcode = models.CharField(max_length=7, null=True)
      email = models.CharField(max_length=50, blank=True, null=True)
      phone = models.CharField(max_length=10, blank=True)
      date = models.DateField()
      
      def __str__(self):
          return "{0}-{1}-{2}".format(self.id, self.date, self.user)
   
          
          
  class OrderLineItem(models.Model):
      user = models.ForeignKey(User, null=False),
      order = models.ForeignKey(Order, null=False, related_name='orders')
      babysitter = models.ForeignKey(Babysitter, null=False)
      quantity = models.IntegerField(blank=False)
      
      def __str__(self):
          return "{0} {1} @ {2}".format(self.quantity, self.babysitter.firstName, self.babysitter.price)</code></pre>
  </div>
  </div>
  </p>