On Sat, Nov 9, 2013 at 11:37 PM, donarb <don...@nwlink.com> wrote: > > The better way is to use the database to find the values, rather than doing > it in Python.
Okay, this is good information to know. Off the top of my head, I'd do something like this: > > def get_context_data(self, **kwargs): > context = super(IndexView, self).get_context_data(**kwargs) > > # Get all active managers from the database > q = Manager.objects.filter(expires__gte=now()) > > # Create a list of all of their email addresses, the values() and > values_list() methods > # can pull out just the fields you want - 'flat' creates a list rather > than a dict or tuple > mlist = q.values_list('user__email', flat=True) > context['mgr_list'] = mlist > return context > More good info there. Thanks. > As I said, I haven't tested this and I may be buggy, but you should be able > to get the idea. > ... > Um, I'm definitely not buggy, but my sample may be... LOL! Are you sure you aren't? I have quite buggy (thinking) at times. But it makes life more interesting. :-) Thanks again. Cheers, Tim -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Uzw%2B0iFVVBXU6mtQH2qpxHbi%2BP6Rk7pm-%3DVM5fYg2QqQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.