mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 06:55:08 +02:00
Add documentation
This commit is contained in:
parent
9119339203
commit
8dc48d21f4
4 changed files with 40 additions and 8 deletions
|
@ -2170,11 +2170,6 @@ class WaffleFlagAdmin(FlagAdmin):
|
|||
|
||||
admin.site.unregister(LogEntry) # Unregister the default registration
|
||||
|
||||
# Unregister samples and switches from django-waffle, as we currently don't use these.
|
||||
# TODO - address this
|
||||
admin.site.unregister(Sample)
|
||||
admin.site.unregister(Switch)
|
||||
|
||||
admin.site.register(LogEntry, CustomLogEntryAdmin)
|
||||
admin.site.register(models.User, MyUserAdmin)
|
||||
# Unregister the built-in Group model
|
||||
|
@ -2199,3 +2194,10 @@ admin.site.register(models.VerifiedByStaff, VerifiedByStaffAdmin)
|
|||
|
||||
# Register our custom waffle flag implementation
|
||||
admin.site.register(models.WaffleFlag, WaffleFlagAdmin)
|
||||
|
||||
# Unregister samples and switches from django-waffle, as we currently don't use these.
|
||||
# Django admin sorts different "sites" alphabetically, and offers little customization for them.
|
||||
# If we do need to use these, we should also consider using this library:
|
||||
# https://pypi.org/project/django-reorder-admin/
|
||||
admin.site.unregister(Sample)
|
||||
admin.site.unregister(Switch)
|
||||
|
|
|
@ -196,12 +196,12 @@ class UserFixture:
|
|||
},
|
||||
]
|
||||
|
||||
def load_users(cls, users, group_name, set_users_superusers=False):
|
||||
def load_users(cls, users, group_name, are_superusers=False):
|
||||
logger.info(f"Going to load {len(users)} users in group {group_name}")
|
||||
for user_data in users:
|
||||
try:
|
||||
user, _ = User.objects.get_or_create(username=user_data["username"])
|
||||
user.is_superuser = set_users_superusers
|
||||
user.is_superuser = are_superusers
|
||||
user.first_name = user_data["first_name"]
|
||||
user.last_name = user_data["last_name"]
|
||||
if "email" in user_data:
|
||||
|
@ -229,5 +229,5 @@ class UserFixture:
|
|||
# steps now do not need to close/reopen a db connection,
|
||||
# instead they share one.
|
||||
with transaction.atomic():
|
||||
cls.load_users(cls, cls.ADMINS, "full_access_group", set_users_superusers=True)
|
||||
cls.load_users(cls, cls.ADMINS, "full_access_group", are_superusers=True)
|
||||
cls.load_users(cls, cls.STAFF, "cisa_analysts_group")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue