> 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
2010/9/24 Jason
>
> "Creating the relationship between User and UserInfo has some
> implications I'd like to avoid on a model-level"
>
> Specifically what are you referring to here? Because anytime you
> subclass in Django you are basically doing the exact thing in the
>
Don't get me wrong - I'm not saying my way is right and I'm not saying
anyone is doing anything necessarily wrong.
I'm still a Django noob in a lot of ways.
Just things to keep in mind - if you do have multiple types of users
subclassing might be a bad idea if there are possibilities of being
Thanks a lot for your answers.
I thought subclassing users is a nice idea, cause a Student IS a user, with
a few extended attributes. I decided to subclass users, because ...
* when adding a UserInfo -> user relationship (class UserInfo(Model): user =
ForeignKey('User')), ALL users having a
> Mainly, I just don't think you're subclassing User for the right
> reasons. In fact, I can't really think of anytime I would subclass
> it. Usually adding a related table is a better way to go (lookup
> django user profiles for example).
>
There are times when the builtin User model is not
I'm not sure how to solve your exact problem but I would recommend NOT
extending the user class here.
You'll probably want to create a manytomany field on your Course model
that contains users.
And if you're going to have many different types of users you'll want
to create groups. Put students
All right, I found some sources.
http://stackoverflow.com/questions/1061279/for-the-django-admin-how-do-i-add-a-field-to-the-user-model-and-have-it-editable
http://blog.picante.co.nz/post/Subclassing-User-to-add-extra-fields-in-the-Django-Admin-Site/
By strictly holding to these, and by
7 matches
Mail list logo