Why is my Django UpdateView not seeing my model data (specifically the id/pk)?
<p>I'm working on a Django Project in which I have a model (Order) which holds various orders received from customers. I'm trying to update one of the Order fields (status) via id using UpdateView (CancelOrder). I've written the UpdateView and modified the urls.py, but when I try to update the status of an order via url I get the error: No order found matching the query, despite having several orders stored. My question is, why is the UpdateView not seeing my model data? Have I missed something?</p>

<p><b>Views.py</b></p>

<pre><code>from django.shortcuts import render, redirect, HttpResponse
from django.core.exceptions import *
from django.views.generic.edit import UpdateView

from menu.models import Item, Order, Customer
from menu.forms import OrderForm, CustForm, UpdateForm
from .serializers import ItemSerializer
from rest_framework import generics

class CancelOrder(UpdateView):
    model = Order
    field = ('status',)
</code></pre>

<p><B>urls.py</B></p>

<pre><code>from django.conf.urls import url, patterns, include
from . import views
from rest_framework.urlpatterns import format_suffix_patterns

urlpatterns = patterns('',
    url(r'^$', views.CreateOrder, name='CreateOrder'),
    url(r'^vieworder/', views.ViewOrder, name='ViewOrder'),
    url(r'^confirmation/', views.ConfirmOrder, name='ConfirmOrder'),
    url(r'^api/$', views.ItemList.as_view()),
    url(r'^api/(?P&lt;pk&gt;[0-9]+)/$', views.ItemDetail.as_view()),
    url(r'^cancel/(?P&lt;pk&gt;[0-9]+)/$', views.CancelOrder.as_view(), name='CancelOrder'),
)

urlpatterns = format_suffix_patterns(urlpatterns)
</code></pre>

<p><B>Model</B></p>

<pre><code>class Order(models.Model):

    order_date = models.DateField(default=timezone.now)
    delivery_date = models.DateField(default=timezone.now)
    status = models.CharField(max_length=10, default='open')
    ordered_by = models.CharField(max_length=50, null=True)

    #user input
    name = models.CharField(max_length=50)
    email = models.EmailField()
    phone = models.CharField(max_length=50)
    shipping_info = models.CharField(max_length=50, null=True)
    billing_info = models.CharField(max_length=50, null=True)
    notes = models.CharField(max_length=150)
    total = models.DecimalField(default=0, max_digits=5, decimal_places=2)
    surcharge = models.DecimalField(default=0, max_digits=5,decimal_places=2)

    def __str__(self):
        return self.name
</code></pre>