All pastes #1468339 Raw Edit

Something

public text v1 · immutable
#1468339 ·published 2009-06-21 02:40 UTC
rendered paste body
from django.db import models

# Create your models here.
class Category(models.Model):
	name = models.CharField(max_length=20)
	def __unicode__(self):
		return self.name

class Product(models.Model):
	name = models.CharField(max_length=50)
	description = models.TextField()
	price = models.DecimalField(decimal_places=2, max_digits=8)
	items_in_stock = models.PositiveIntegerField()
	image = models.ImageField(upload_to='product_images')
	
def post_save_handler(sender, **kwargs):
	print("Signal caught!")

models.signals.post_save.connect(post_save_handler, sender=Product)