class OrderStatus models Model An order will have multiple statuses as

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class OrderStatus(models.Model):
"""
An order will have multiple statuses as it moves its way through processing.
"""
order = models.ForeignKey(Order, verbose_name=_("Order"), edit_inline=models.STACKED, num_in_admin=1)
status = models.CharField(_("Status"),
max_length=20, choices=ORDER_STATUS, core=True, blank=True)
notes = models.CharField(_("Notes"), max_length=100, blank=True)
timestamp = models.DateTimeField(_("Timestamp"))
def __unicode__(self):
return self.status
def save(self):
super(OrderStatus, self).save()
self.order.status = self.status
self.order.save()
class Meta:
verbose_name = _("Order Status")
verbose_name_plural = _("Order Statuses")