Skip to content

Instantly share code, notes, and snippets.

@JonnatasCabral
Last active August 29, 2015 14:27
Show Gist options
  • Save JonnatasCabral/b5f9e618c2bb434bff83 to your computer and use it in GitHub Desktop.
Save JonnatasCabral/b5f9e618c2bb434bff83 to your computer and use it in GitHub Desktop.
import itertools
def get_context_data(self, **kwargs):
context = super(RelatorioPautaView, self).get_context_data(**kwargs)
docs = Audiencia.objects.all().order_by(
'processo_dpvat__estado', 'processo_dpvat__estado')
docs_mutuario = [
(tipo, [x for x in doc_list])
for tipo, doc_list in itertools.groupby(
docs, lambda x: x.processo_dpvat.estado)]
context['group'] = docs_mutuario
return context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment