> Well, first I can to "if X == Student: ...", and I know the fields will be > there. > Second, User will have no additional properties (as I understand), but once > I do "Model --> User" relations ALL users will have that property. So each > user might have the .course property, AND the .subject property (which might > be for teachers), AND the .function property, which might be for > administrative staff (I'm making things up here :). So all properties would > be present, they may not be mandatory, cause a teacher is never part of a > course, so I have to ensure data consistency in the application logic. That > sucks. > > Subclassing relieves me from this just nicely, AND this is the mother of all > prototype examples of OOP - base class, specialized subclasses. The only > thing more cliché would be "Car" -> "Van" / "Compact" / ... .
I subclass a lot of stuff in Django. It's useful, I agree. I'm ALL about OOP. My gut tells me to leave that stuff out of Auth.User. If you were extending the authorization / authentication aspects of it, I would agree. You're adding courses though which does not at all sound like a good idea to me. Course should be a model and it should have a manytomany field for users or other intermediate table if you need more attributes on the relationship itself. "Well, first I can to "if X == Student: ...", and I know the fields will be there." You can do that as well with groups by adding the information as they are added to the group. (signals, etc). "...but once I do "Model --> User" relations ALL users will have that property." Well, all users will be able to query the attribute but it will just be null. some_dude = Users.objects.get(username='the_dude') courses = some_dude.course_set.all() Anyhow - the real deal breaker for me is overlapping user types. If that's not a problem, you'll probably be fine in making it work. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.