From e9249bc20b49c7b6721a8a58bc4bb9dd4827855a Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Tue, 1 Jul 2014 20:54:46 -0700 Subject: [PATCH] Fixed #22932: Documented circular dependency issues with swappable user --- docs/topics/auth/customizing.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index 7141d9ccd3..a70753132c 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -399,6 +399,14 @@ use as your User model. is created in the first migration of its app (usually called ``0001_initial``); otherwise, you will have dependency issues. + In addition, you may run into a CircularDependencyError when running your + migrations as Django won't be able to automatically break the dependency + loop due to the dynamic dependency. If you see this error, you should + break the loop by moving the models depended on by your User model + into a second migration (you can try making two normal models that + have a ForeignKey to each other and seeing how ``makemigrations`` resolves that + circular dependency if you want to see how it's usually done) + Referencing the User model --------------------------