-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom AUTH_USER_MODEL
Creates Migration Circular Reference?
#215
Comments
Were you able to resolve this? |
Unfortunately not, sorry @iamprakashom . |
1. Circular Dependency Issue I found this occurs when BOTH the initial user account migration AND the django-organizations migrations are being generated at the same time. We found ourselves in this scenario this after doing some refactoring before our first production release 2. weird output - a migration is created against the organizations module in the virtual environment Yes, we nearly missed this before release to staging etc. As I understand it.... Option A.
BUT then you have to copy the original ones into here, before running EDIT: to keep on top of this, we have a small script inside
Option B. Neither option seems brilliant. good luck |
Thanks for this. Splitting up into two sets of migrations worked well. Luckily commenting all the stuff out was a viable option for me. Don't know what I would have done if had had a bunch of code to isolate. |
This should really be fixed |
@pfcodes would you mind rewording that in the active voice? The folks on this issue thread have put work into describing the issue they've encountered. I for one would heartily welcome a pull request to resolve this issue, and if you'd like to put in the work it will be most welcome! |
Following the exact example by @vector-kerr above reproduces the exact issue as described.
Amending the example to instead include the custom user model in a separate
It's hard to know if the example is just contrived for simplicity (which is completely reasonable) or representative of typical use. However given what I've seen here and what I've seen in the migrations, my current suspicion is that this is the case. The initial I've never included custom users in the same app as custom organizations and so never even thought to ask if that was the production use case. If it is I would gently recommend against doing that, this issue notwithstanding. However if that is the common scenario then the solution here is going to be installation guidelines, because I do not think there is any code solution to the issue as described. |
Hey @bennylope, thank you for taking the time to look into this! It's been quite some time since I encountered this issue, but from what I can recall, I was trying to stand up a basic use case, hence the all-in-one-app. If it doesn't exist, some guidelines or a note to indicate that custom users should exist in a separate app would probably be more than sufficient to consider this done. Thanks again! |
Greetings!
I'm having a go at using
django-organizations
, and I've been getting a circular reference error when attempting to perform migrations, which I believe I can trace back todjango-organizations
and using a customAUTH_USER_MODEL
.I say 'I believe' because I'm not 100% sure that I haven't done something incorrectly, but having read the documentation on using a custom user model and proxy models, I think I've covered myself...
I've included a set of steps to reproduce below which should hopefully demonstrate that either I'm doing something woefully wrong, or there's something weird going on with custom user models.
If you need any more information, or if I've stupidly broken it somehow, please let me know. :)
Thanks for your help and your time!
- Vector
Steps to reproduce
python3 -m venv .venv source .venv/bin/activate
demo
) and enter the directory:django-admin startproject demo cd demo
core
which will be used for models and migrationscore/models.py
:demo/settings.py
to include theorganizations
andcore
apps, and set the custom user model:organizations
module in the virtual environment:The text was updated successfully, but these errors were encountered: