Skip to content

Instantly share code, notes, and snippets.

@bmease
Created November 23, 2013 16:31
Show Gist options
  • Save bmease/7616715 to your computer and use it in GitHub Desktop.
Save bmease/7616715 to your computer and use it in GitHub Desktop.
@receiver(post_save, sender=User)
def create_default_shelves(sender, **kwargs):
'''Creates default shelves for a user'''
if kwargs['created'] is True:
user = kwargs['instance']
for name, slug in DEFAULT_SHELF_NAMES:
shelf = Shelf(name=name, slug=slug, user=user)
shelf.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment