Last active
July 25, 2016 21:50
-
-
Save cavb/677f3f1f9189851209da5797f8e4e38d to your computer and use it in GitHub Desktop.
Python: Print only names of an array ordered by name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_categories(self): | |
''' Return categories as text for printing on templates ''' | |
return ''.join( | |
[x.name +'-' for x in self.category.all().order_by('name')] | |
)[:-1] # Removes last '-' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment