Skip to content

Instantly share code, notes, and snippets.

@fsouza
Created January 21, 2011 12:58
Show Gist options
  • Save fsouza/789638 to your computer and use it in GitHub Desktop.
Save fsouza/789638 to your computer and use it in GitHub Desktop.
class Categoria(models.Model):
nome = models.CharField(max_length=100)
supercategoria = models.ForeignKey("Categoria", related_name="subcategorias", blank=True, null=True, on_delete=models.SET_NULL)
slug = models.SlugField(max_length=100, blank=True)
# representação do model como unicode
def __unicode__(self):
return self.nome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment