Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:4088912
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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
Something went wrong with that request. Please try again.