Good morning people.
I made ​​a signal that plays m2m table values ​​to a dictionary.
For example:

dic = {'SECTOR': {'forbidden': [Genres ,...], 'released':
[Genres ,...]}}

There is a table of company sectors, each of these sectors has
access rules prohibited and released. The genres are content that
staff can not access, for example pornography, sports,
etc ...

When this rule except for the FIRST TIME, I get the SECTORS but
Gender is empty.
dic = {'FINANCIAL: {' forbidden ': [],' released ': []}}

Here's the function that fulfills this dictionary:

def dic_acesso():
        regra = Acesso.objects.filter(status=True)
        dic_acesso = {}
        for ind in regra:
                ind_s = str(ind)
                dic_acesso[ind_s] = {}
                lista_genero_proibido = []
                lista_genero_liberado = []
                for gp in ind.proibido.all():
                        lista_genero_proibido.append(str(gp))
                for gl in ind.liberado.all():
                        lista_genero_liberado.append(str(gl))
                dic_acesso[ind_s]['proibido'] = lista_genero_proibido
                dic_acesso[ind_s]['liberado'] = lista_genero_liberado
        return dic_acesso

Thanks,

Eduardo Orige

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to