Django multiple User profiles/subprofiles

前端 未结 3 882
别那么骄傲
别那么骄傲 2020-12-30 17:42

I am trying to create an intranet/extranet with internal/external user-specific profiles, with a common generic profile. I\'ve looked at several answers on this site, but n

3条回答
  •  不知归路
    2020-12-30 18:15

    You need a combination of storing additional information about users and model inheritance.

    Basically, you'll need the generic User models we all know and either love or hate, and then you need a generic profile model that is your AUTH_PROFILE_MODULE setting.

    That profile model will be a top-level model, with model subclasses for internal and extrernal users. You probably don't want an abstract model in this case since you'll need a common profile table to load user profiles from with User.get_profile().

    So...I think the major thing you want to change is to make your Associate, External, etc. models inherit from your Profile model.

提交回复
热议问题