我有这个模型课:
class Proficiency(models.Model):
name = models.CharField(max_length=40, unique=True)
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='children')
class ProfessionalProfile(models.Model):
user_profile = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
class ProfessionalProficiency(models.Model):
proficiency = models.ForeignKey(Proficiency, on_delete=models.CASCADE, unique=False)
professional_profile = models.ForeignKey(ProfessionalProfile, on_delete=models.CASCADE, unique=False)
从UserProfile到ProfessionalProficiency访问数据的正确方法是什么?