> Den 15/05/2015 kl. 20.54 skrev Timothy W. Cook <[email protected]>:
> 
>     def formfield_for_many_to_many(self, db_field, *args, **kwargs):
>         formfield = super(ClusterAdmin, 
> self).formfield_for_many_to_many(db_field, *args, **kwargs)
>         if db_field.name in 
> ['cluster','dvboolean','dvuri','dvstring','dvcodedstring','dvidentifier','dvparsable','dvmedia',
>                              
> 'dvordinal','dvcount','dvquantity','dvratio','dvtemporal']:
>             formfield.queryset = formfield.queryset.select_related('project')
>         return formfield
> 
> 
> 
> ​Each of the ManyToMany references have this in their model:
> 
> 
> ​    def __str__(self):
>         return self.prj_name.prj_name + ":" + self.data_name

Are you sure you don't mean

   formfield.queryset.select_related('prj_name')

If 'prj_name' is the FK on your m2m models, then that's what should be passed 
to select_related()

Django 1.8 should catch this for you, if 'project' isn't also a FK on your 
model.

Erik

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/D28F7970-28EB-46DE-9FD2-3BD3F63A085E%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to