Skip to content

Instantly share code, notes, and snippets.

@m-bo-one
Created March 12, 2016 13:22
Show Gist options
  • Save m-bo-one/7b531e60e45b311512be to your computer and use it in GitHub Desktop.
Save m-bo-one/7b531e60e45b311512be to your computer and use it in GitHub Desktop.
def username_for_change(change):
author = change.author
username = 'noname'
try:
if author:
username = author.username or 'noname'
except ObjectDoesNotExist:
pass
return username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment