Usecase
The app that I am developing is about linking startup, job seekers and investors. Sorry I could not give the name still though I have developed already around 40% :) .There will be three entities. One is Startup account, Enduser account and Investor account. I am thinking of adding follow/unfollow feature where
- Enduser can follow Startup and vice-versa
- Startup can follow Investor and vice-versa
- Enduser cannot follow other enduser and enduser cannot follow investor
For this how should I model my application
Here is the model for the entities I talked about
Enduser Model
class UserSetting(models.Model):
user = models.OneToOneField(User)
job_interest = models.ManyToManyField(Category, related_name='user')
is_email_notification = models.BooleanField(
default=True, help_text="Email me job recommendations based on my interests and preferences")
class Meta:
verbose_name = 'User Setting'
verbose_name_plural = 'User Settings'
def __str__(self):
return self.user.username
Startup Model
class Startup(models.Model):
name = models.CharField(max_length=200, unique=True,
blank=False, null=False)
slug = models.SlugField(unique=True)
description = models.CharField(max_length=400)
Investor Model
class Investor(models.Model):
investor = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=200, blank=False,
null=False, help_text='Full Name')
slug = models.SlugField(max_length=200, unique=True)
contact_email = models.EmailField(null=True, blank=True)
# for now I have done like this
followers = models.ManyToManyField(
User, related_name='followers', blank=True)
For now, you can see I have included the followers field in the Investor but I need the follower system in the startup as well so that enduser can follow startup and vice-versa. Also in following investor only startup can follow but enduser should not.
What is the best possible solution for this?