On Tue, 2009-01-27 at 21:44 +0100, Alex Rades wrote:
[...]
> my situation is: It's a site for students and companies, where
> students can post their data and search for internships, and companies
> post their data, internship opportunities, and search for students.
> 
> So, students have to fill their profile with student-related stuff and
> companies have their own kind of profile with company related stuff.
> 
> Therefore, in this situation, I don't think it is wise to go with your
> idea #2 (use only 1 user model and implement a permissions-style
> system) since these two kind of users are so different. Think about
> this: I want the degree field to be mandatory for students, while of
> course it doesn't apply for companies.

Thought #2 was orthogonal to thought #1. You can still have the profile
class contain a generic relation to the per-user-customised type of
profile class.

> About your idea #1, I think this could be wiser in my case. I could
> just place a <select> near the login form, with two options: Student
> and Company, then I could wrap the generic login view to create the
> right kind of user, and from that moment, user.get_profile() should
> give me back the right kind of profile.

Well, it will give you back the common profile class, from which you can
descend, with another database query to the specific class. Generic
Relations aren't automatically retrieved (even using select_related()).
However, that won't affect how you write the code: you just access
attributes normally, like you do with normal relations.

A third option is to consider just not using the User profile support,
but writing a helper method that accepts a user instance and returns the
right sort of profile class based on, say, the type of user or something
like that.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to