python - django how to use AUTH_PROFILE_MODULE with multiple profiles? -


assuming have different profiles different user types - staff, teacher,students:

how specify auth_profile_module in order appropriate profile get_profile?

there no way use generic key.

from django.contrib.contenttypes import generic django.contrib.contenttypes.models import contenttype  class userprofileone(models.model):     pass  class userprofiletwo(models.model):     pass   class userprofile(models.model):     content_type    = models.foreignkey(contenttype)     object_id       = models.positiveintegerfield(db_index=true)     content_object  = generic.genericforeignkey('content_type', 'object_id') 

example:

userprofile.objects.create(content_object=any_profile_instance)  user(pk=1).get_profile().content_object.some_special_field 

if provide more infos, when might possible find better solution :)


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -