Set default_auto_field to 'AutoField'
simkimsia opened this issue · comments
Django 3.2 introduces DEFAULT_AUTO_FIELD . If you set this to something other than 'django.db.models.AutoField', migrations will need to be generated for django-organization's models. This pull request sets default_auto_field just for these apps so that no migrations need to be generated.
It also hides warnings on Django 3.2.
The specific warning is
RemovedInDjango41Warning: 'organizations' defines default_app_config = 'organizations.apps.OrganizationsConfig'. Django now detects this configuration automatically. You can remove default_app_config.
app_config = AppConfig.create(entry)
Similar in another highly used django library pennersr/django-allauth#2829
EDIT
Change allauth
to django-organization
For those who are looking for workaround while waiting for the PR #224 to be merged, here's the workaround.
GO to your apps.py
in your django project and add this at the end of the file. Do remember to remove it after the PR is merged
from organizations.apps import OrganizationsConfig
class ModifiedOrganizationsConfig(OrganizationsConfig):
default_auto_field = "django.db.models.AutoField"
in your settings.py where you declare your third_party_apps
THIRD_PARTY_APPS = [
...
# "organizations", # you should comment this out and when the PR is merged, uncomment it
"yourproject.apps.ModifiedOrganizationsConfig", # remove this when PR is merged
....
]
LOCAL_APPS = [
"yourprojectapp",
]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
I was very confused by this:
Django 3.2 introduces DEFAULT_AUTO_FIELD . If you set this to something other than 'django.db.models.AutoField', migrations will need to be generated for allauth's models. This pull request sets default_auto_field just for these apps so that no migrations need to be generated.
But that if that reads "django-organization's models" then it makes a lot more sense!
Thank you @simkimsia!
But that if that reads "django-organization's models" then it makes a lot more sense!
Oh right.. sorry!
@bennylope pls update pypi for a new version if you don't mind. I like to update the dependency so i can stop using the workard i detailed here.
@simkimsia it's live now, thank you again https://pypi.org/project/django-organizations/#history