On Fri, Aug 19, 2011 at 9:27 AM, Andre Terra <andrete...@gmail.com> wrote: > Alright, do what you will. Whatever floats your boat.. > > On Fri, Aug 19, 2011 at 5:12 AM, Matt Schinckel <m...@schinckel.net> wrote: >> >> On Friday, August 19, 2011 12:07:44 PM UTC+9:30, Andre Terra (airstrike) >> wrote: >>> >>> Until you install some third party app that accesses >>> User.objects.all() and then suddenly nothing works as it's supposed >>> to. >> >> Why wouldn't it? The User subclasses will still appear in the >> User.objects.all() queryset. >>> >>> You can access the User object from its related UserProfile instance >>> and do everything you say from there instead of breaking the >>> convention. Nobody's stopping you from writing an abstract >>> BaseUserProfile model with an FK to User and custom UserProfile >>> subclasses. I just don't see any advantages in going down that path. >> >> As I said, 'at this stage', it all seems to be working out okay. I have >> plenty of 3rd party apps, and even some of my own, that access User, and >> they still work with sub-classes. >>> >>> Because how will you access every user if you ever need to? What if >>> someone gets promoted? How will you separate view from model logic? >>> Are you going to rewrite forms for every user class? That's probably >>> going to be hard to maintain. >> >> You can still access User.objects.all(). I even have a way to access the >> sub-classes (downcasting) when fetching all users. >>> >>> FWIW, profiles are the canonical solution. They are also the only >>> elegant solution, at least until the app loading branch lands on >>> trunk, which should then allow you to register a different class as >>> User. But that won't happen any time soon.. >> >> See, I don't see them as an elegant solution. Having to do: >> user.get_profile().date_of_birth >> instead of: >> user.date_of_birth >> irks me every time I write the code. UserProfile has always felt to me >> that it was a patchy way of extending User. >> Matt. >>
Not being able to define your own User model is easily my least favorite thing about django. User.get_profile() is an antipattern. I hope we get the ability to define our own User model makes it into contrib.auth at some point (lazy loaded) -- 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.