'What is the way for me to get rid of Reverse Accessor error in Django (fields.E304)

I am trying to create these models :

class User(models.Model):
    name = models.CharField(max_length=USERNAME_LEN)

class Room(models.Model):
    host = models.ForeignKey(User, on_delete=models.CASCADE)
    users = models.ManyToManyField(User)

In my mind, I want something in the lines of :

  • One User can access to multiple Rooms
  • One User can host mutliple Rooms
  • One Room can have mutliple Users
  • One Room have one host that is an User

However, trying to migrate those, I get an error and as I am not an expert on SQL relations nor in Django, I'd like to know what is the best way for me to make this.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source