diff --git a/api/base/settings/defaults.py b/api/base/settings/defaults.py index 54fdc767286..8665b526e07 100644 --- a/api/base/settings/defaults.py +++ b/api/base/settings/defaults.py @@ -373,3 +373,5 @@ CITATION_STYLES_REPO_URL = 'https://github.com/CenterForOpenScience/styles/archive/88e6ed31a91e9f5a480b486029cda97b535935d4.zip' DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + +WAFFLE_ENABLE_ADMIN_PAGES = False # instead, customized waffle admins in osf/admin.py diff --git a/osf/admin.py b/osf/admin.py index 7b8257389c5..2142ab2648a 100644 --- a/osf/admin.py +++ b/osf/admin.py @@ -6,6 +6,7 @@ from django.db.models import Q, Count from django.http import HttpResponseRedirect from django.urls import reverse +import waffle from osf.external.spam.tasks import reclassify_domain_references from osf.models import OSFUser, Node, NotableDomain, NodeLicense @@ -140,7 +141,20 @@ def get_queryset(self, request): qs = super().get_queryset(request).annotate(number_of_references=Count('domainreference')) return qs + +class _ManygroupWaffleFlagAdmin(waffle.admin.FlagAdmin): + '''customized `waffle.admin.FlagAdmin` to support many groups + + (reverse incorrect assumption in https://github.com/jazzband/django-waffle/commit/bf36c19ee03baf1c5850ffe0b284900a5c416f53 ) + ''' + raw_id_fields = (*waffle.admin.FlagAdmin.raw_id_fields, 'groups') + + admin.site.register(OSFUser, OSFUserAdmin) admin.site.register(Node, NodeAdmin) admin.site.register(NotableDomain, NotableDomainAdmin) admin.site.register(NodeLicense, LicenseAdmin) + +admin.site.register(waffle.models.Flag, _ManygroupWaffleFlagAdmin) +admin.site.register(waffle.models.Sample, waffle.admin.SampleAdmin) +admin.site.register(waffle.models.Switch, waffle.admin.SwitchAdmin) diff --git a/requirements.txt b/requirements.txt index 8bfba5aeccf..ba1a4f92049 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ google-api-python-client==1.6.4 Babel==2.9.1 citeproc-py==0.4.0 boto3==1.4.7 -django-waffle==2.4.1 +django-waffle==2.5.0 # TODO: 4.1.0 when python 3.8+ pymongo==3.7.1 PyYAML==6.0.1 tqdm==4.28.1