Skip to content

Instantly share code, notes, and snippets.

@aaronlelevier
Created September 1, 2014 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronlelevier/c98f367ac6e3846e81cb to your computer and use it in GitHub Desktop.
Save aaronlelevier/c98f367ac6e3846e81cb to your computer and use it in GitHub Desktop.
# ---------------------------- None View Helper Functions ------------------------------------
# Place to save image upload file
def handle_uploaded_file(f):
with open(content_file_name(f), 'wb+') as destination:
for chunk in f.chunks():
destination.write(chunk)
# Attempt Imagefield
def content_file_name(instance, filename):
return '/'.join([filename])
def newPassword():
a = random.randrange(97,122)
b = random.randrange(5,122,7)
c = random.randrange(97,122)
d = random.randrange(7,122,6)
e = random.randrange(97,122)
return str(chr(a)) + str(ord(chr(b))) + str(chr(c)) + str(ord(chr(d))) + str(chr(e))
# Helper function to look up Book Obj. using display_url
def uncode_display_url(book_id):
book = book_id.split('-')
ans = ' '.join(book)
return ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment