Create a gist now

Instantly share code, notes, and snippets.

class FolderManager(models.Manager):
# so that we can do Folder.objects...
def get_query_set(self):
return super(FolderManager, self).get_query_set().filter(is_folder=True)
class Folder(Item):
this class is kind of funny looking because Items cannot have
a ForeignKey field pointing to a subclass of itself.
objects = FolderManager()
def __init__(self, *args, **kwargs):
# override the default behavior of the is_folder field
self._meta.get_field('is_folder').default = True
super(Folder, self).__init__(*args, **kwargs)
class Meta:
# don't create a table
proxy = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment