python - Django From Choices Tuple Concatnation -


i'm trying in form:

sites = list( site.objects.all().order_by('site_code') ) sites = ((s.site_code, s.site_code) s in sites ) site_choices = ('all', 'all') + (sites,) 

i know can't concatenate 2 tuples, , makes new reference of tuple, error getting

object.__new__(generator) not safe, use generator.__new__() 

i've tried different things trying add tuple directly in comprehension, etc no luck. have better solution this?

thanks

have tried using lists instead of tuples?

sites = [(s.site_code, s.site_code) s in site.objects.all().order_by('site_code')] site_choices = [('all', 'all')] + sites 

hope helps.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -