[Fixed]-Unexpected Circular Dependency in migration files

1👍

Solution 1: move the AppUser’s many2many to SongLang and SongGenre. A m2m relationship is by default symetric so you can declare it on either side of the relationship (nb: just make sure to set the related_name to how your fields was named in the AppUser model).

Solution 2: move your SongGenre and SongLang models to a third app (the canonical solution to circular dependencies)

Solution 3: eventually try to first create the AppUser model without the m2m fields, creates the initial migration, then add the m2m fields (not sure it will work though).

Leave a comment