Dear all, I'm working with a proxy model of django's User.
I need to convert the user from the request into an instance of my proxy. At the moment I have the following method in my class: @classmethod def from_parent_user(cls, user): # return cls.objects.get(pk=user.pk) member = cls() single_fields = cls._meta.fields for field in single_fields: setattr(member, field.name, getattr(user, field.name)) multiple_fields = cls._meta.many_to_many for field in multiple_fields: # seems to work, not sure if its safe: getattr(member, field.name).__dict__.update(getattr(user, field.name).__dict__) return member I know I could obviously do return cls.objects.get(pk=user.pk), but that seems a useless query to me, all the information I need is already in the User instance, right? So my question. Best way to implement this please? Is what I'm doing save? My test pass but it might break some internals... I don't know. 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.