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 - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -