Hi guys
-- I'm on Django 1.10, and as described shortly here: https://dpaste.de/Bgao, I have created an abstract user profile which is tied to Django's User model with OneToOneField relationship. So I have AbstractProfile, and then there are IndividualProfile and BusinessProfile, each of which inherits from AbstractProfile.
The problem I have, is that, whenever I have a user object instance (i.e. u = User.objects.get(pk=1234)), I'm not sure how to determine whether the profile is of type Individual or Business.
So either u.individualprofile or u.businessprofile throws an error, and obviously I want to avoid having errors.
Any help is appreciated. Thanks
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3dac6122-c209-415e-af62-387988c384d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment