Update 1-serialization.md (#6781)

Assigning a sorted list to STYLE_CHOICES by using a list comprehension.
This commit is contained in:
Alex Ayon 2019-07-04 07:41:15 -05:00 committed by Tom Christie
parent 989aeca205
commit a3eeeb20e7

View File

@ -60,7 +60,7 @@ For the purposes of this tutorial we're going to start by creating a simple `Sni
LEXERS = [item for item in get_all_lexers() if item[1]] LEXERS = [item for item in get_all_lexers() if item[1]]
LANGUAGE_CHOICES = sorted([(item[1][0], item[0]) for item in LEXERS]) LANGUAGE_CHOICES = sorted([(item[1][0], item[0]) for item in LEXERS])
STYLE_CHOICES = sorted((item, item) for item in get_all_styles()) STYLE_CHOICES = sorted([(item, item) for item in get_all_styles()])
class Snippet(models.Model): class Snippet(models.Model):