Django Multiple User Profiles with Class based views (Best Practices)
<p>I have a website where there are two kinds of users (say) : students and tutors.</p>

<p>Both types have common login functionality, age, gender etc but have distinct attributes such as report cards for students and degree certificates for tutors.</p>

<p>I read this question :  <a href="https://stackoverflow.com/questions/9650133/django-multiple-user-profiles">Django - Multiple User Profiles</a> and setup my profiles as shown below:</p>

<pre><code>class UserProfile(models.Model):
    user = models.OneToOneField(User, primary_key=True, related_name='profile')
    mobile = models.CharField(max_length=10, blank=False, null=True)
    picture = models.ImageField(
        upload_to='images/', default='images/newuser.png')
    age = models.IntegerField(null=True)
    slug = models.SlugField()
    ...
</code></pre>

<p>And two other models that link to the above. Eg:</p>

<pre><code>class StudentProfile(models.Model):
    profile = models.ForeignKey(UserProfile, related_name="user_profile")
    #more custom attributes

class TutorProfile(models.Model):
   profile = models.ForeignKey(UserProfile, related_name="doctor_profile")
   #more custom attributes
</code></pre>

<p>Now my questions:</p>

<p>1) <code>SlugField</code> is defined on the <code>UserProfile</code> attribute but will ideally use the <code>User.username</code> field. This means a join between these two tables will happen each time. Is this to be expected?</p>

<p>2) Assuming I am using class based views, editing/viewing the profile will depend on the <code>UserProfile</code> in question. But I want the user to be able to edit/view all his details on the same page. Thus, I will have to fetch <code>TutorProfile</code> / <code>StudentProfile</code> too and add custom logic to ensure updates happen to them too. </p>

<p>It seems to me that there should be a proper way of handling these situations (Since a lot of websites have similar requirements). What are the best practices to be followed in such a situation?</p>