Hades_L wrote: > Hello, > I'm having trouble dealing with User module. In my application, I have > two types of users who should be able to log in. > The first one is an Employee, so I have a code like this: > class Employee(models.Model): > someFields = ... > ... > user = models.ForeignKey(User) > > and the other model is a Client: > class Client(models.Model): > otherFields... > user = models.ForeignKey(User) > > In my settings.py file I define AUTH_PROFILE_MODULE as myapp.Employee. > > So you see the problem here, I can't associate my client's profile > with the User model. I could manage myself to deal with this without > using get_profile decorator, but if someone ever had a similar issue, > i'd love to know how he design his application to have a beautiful > solution (only one model for Employee and Client ?). :)
I'd guess having only one model is the "correct" answer most of the time. Can't really say what's best without knowing more about your project. But, here are a few ideas to consider. Have only one user_profile model and use the auth permissions / groups system to distinguish between client/employee. http://www.djangoproject.com/documentation/authentication/#permissions Have only one (lite) user_profile model and use contenttypes framework to "connect" employee records to Employee Model and clients to Client Model. http://www.djangoproject.com/documentation/contenttypes/ Ditch/copy Django's auth and roll your own/modify it to work they way you need. -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman ___________________________________________________________________________ You've got fun! Check out Austin360.com for all the entertainment info you need to live it up in the big city! --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---