Hi,

I have an Member(AbstractUser) Model declare as AUTH_USER_MODEL with lot of relations, wich have themselves a lot of relations. It's for now quite usefull to use request.user in templates to display relations without specifying anything in the views. But at one time (production with lot of users) I will have an issue with postgres queries so I wonder what is the best way to add prefetch_related and select_related options to Member queries so that they exist in the request.user.

I can't find in the django code where the request is populated with the User model, but I would like to read this part.

Is it ok to update request.user via another custom templates context processor like this request.user = Member.objects.get(...).prefetch_related(...)... , or maybe it's not a good idea ?

What I could do ?
1 modify the auth middleware :/
2 modify default model queries :\
3 modify it with an already existant custom templates context processor :)
4 add new instance of it (like "member") in custom templates context processor whenever if there's duplicate entries between request.user and member.
5 other way

I need a way.

Thanks

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d0af460a-dfa4-7ad3-2e92-174728ca9a92%40free.fr.

Reply via email to