Skip to content

Instantly share code, notes, and snippets.

@benmcnelly
Created May 19, 2011 15:52
Show Gist options
  • Save benmcnelly/981090 to your computer and use it in GitHub Desktop.
Save benmcnelly/981090 to your computer and use it in GitHub Desktop.
class Item(models.Model):
title = models.CharField(max_length=128)
photo = models.ImageField(upload_to="photos/",null=True, blank=True,)
description = models.TextField(null=True, blank=True,)
section = models.ForeignKey(Section)
order = models.IntegerField(null=True, blank=True,)
creation_date = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
active = models.CharField(max_length=21, choices=ACTIVE_CHOICES,null=True, blank=True)
@models.permalink
def get_absolute_url(self):
return ('menu_item_detail', (), {
'menu_name':, self.menu.slug,
'section_name': self.section.slug,
'item_id': self.id })
def __unicode__(self):
return self.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment