All pastes #1468297 Raw Edit

models.py

public text v1 · immutable
#1468297 ·published 2009-06-21 01:39 UTC
rendered paste body
from django.db import models
from django.core.signals import request_finished
import os

# 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(sender, **kwargs):
		print("Signal caught!")

	request_finished.connect(post_save)