The point of using a OneToOne relation to create a 'profile' is that the profile is meant to contain information that is only accessed on an individual basis (such as displaying a single users' address, etc.), and generally not involved on bulk queries as you describe.
If your __str__() method in your primary user model accesses an attribute via a foreign key lookup (ie OneToOne), then you'll get the behavior you are describing. You want the data that you'll need all or most of the time in the primary model to avoid that situation. In this case, I would suggest you look at the attribute you're referencing and move it directly into the primary user model.
I'm a little worried about what you mean by 'monkey patching'. Did you just override the __str__() methods on your primary model?
-James
--
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...@googlegroups.com.
To post to this group, send email to django...@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/5bdd87b6-9cc6-4490-8b85-d25ecfe8ed16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I am not aware of a good solution to this problem other than manually
adding the .select_related() to your query on the list-of-users page.
> I am really unhappy with idea of using custom user model.
Why?
If it's because this is an existing project and the prospect of
migrating your existing data to a custom user model is daunting, I
totally understand that. It's doable, but hard.
for any suggestions how to domesticate django on this shared server i'd be very happy.
The point of using a OneToOne relation to create a 'profile' is that the profile is meant to contain information that is only accessed on an individual basis (such as displaying a single users' address, etc.), and generally not involved on bulk queries as you describe.
If your __str__() method in your primary user model accesses an attribute via a foreign key lookup (ie OneToOne), then you'll get the behavior you are describing. You want the data that you'll need all or most of the time in the primary model to avoid that situation. In this case, I would suggest you look at the attribute you're referencing and move it directly into the primary user model.
I'm a little worried about what you mean by 'monkey patching'. Did you just override the __str__() methods on your primary model?
> I am really unhappy with idea of using custom user model.
Why?
If it's because this is an existing project and the prospect of
migrating your existing data to a custom user model is daunting, I
totally understand that. It's doable, but hard.Yes, this project already deployed and has some data. Sure I can solve this, but I feel that changing user model will make my app less reusable.
But I will probably stay with new model. There is something wrong with Django in this area. There should be some easy and elegant way to add one field to auth_user. I wonder why Django developers do not care about it.
--
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...@googlegroups.com.
To post to this group, send email to django...@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/D96C8E64-18CA-4E2A-B9BD-D384AD563766%40zetteeh.net.