In my website, there are many teams. The team members have powers. These powers are depending on the member's role.
On the website, some members can do actions specifics to role. Example: Member with the power to fly can create articles (class Article(Models.model) ) on the website.
I need help for the conception of my DB.
Currently, I have the following:
class Subscribe(models.Model):
user = models.OneToOneField(User)
...
class Team(models.Model):
name = models.CharField(...
...
class BelongsTeam(models.Model):
username_subscribe=models.CharField(max_length=30)
team = models.OneToOneField(Team, null=False)
name_team= models.CharField(max_length=24)
class Meta :
abstract = True
class Member(BelongsTeam):
POWERS = (('Fast','Fast'),('Fly','Fly'))
power = models.CharField(max_length=13,choices=POWERS,default='Fast')
So when new team recruits subscribe:
def recruits(request,usernamesubscribe,nameteam):
the_team = Team.objects.get(name=nameteam)
member = Member(username_subscribe=usernamesubscribe,team=the_team,name_team=the_team.name)
member.save()
return render(...
This system works but I have doubts about the quality of this system.
Is it a good idea to use the Django groups system?
What do you think about my team system?