diff --git a/django/cantusdb_project/main_app/management/commands/merge_indexer_user.py b/django/cantusdb_project/main_app/management/commands/merge_indexer_user.py index ec2e58d36..435506bd3 100644 --- a/django/cantusdb_project/main_app/management/commands/merge_indexer_user.py +++ b/django/cantusdb_project/main_app/management/commands/merge_indexer_user.py @@ -14,9 +14,9 @@ def handle(self, *args, **options): indexers = Indexer.objects.all() for user in users: - # set all users to be hidden first + # set all users to be non-indexer first # those listed as indexers on old Cantus will have this adjusted to True - user.show_in_list = False + user.is_indexer = False # do not use the existing "name" property, # because for some reason, the first/last names can have trailing spaces # TODO: populate the full_name field and remove the "name" property @@ -38,7 +38,7 @@ def handle(self, *args, **options): # keep the user as it is (merge the indexer into existing user) # and store the ID of its indexer object homonymous_user.old_indexer_id = indexer.id - homonymous_user.show_in_list = True + homonymous_user.is_indexer = True homonymous_user.save() # if the indexer doesn't exist as a user else: @@ -54,5 +54,5 @@ def handle(self, *args, **options): # the password can't be empty in login form, so they can't log in password="", old_indexer_id = indexer.id, - show_in_list=True, + is_indexer=True, ) diff --git a/django/cantusdb_project/main_app/management/commands/sync_indexers.py b/django/cantusdb_project/main_app/management/commands/sync_indexers.py index 99407b89a..d589db0e2 100644 --- a/django/cantusdb_project/main_app/management/commands/sync_indexers.py +++ b/django/cantusdb_project/main_app/management/commands/sync_indexers.py @@ -52,7 +52,7 @@ def get_new_indexer(indexer_id): # keep the user as it is (merge the indexer into existing user) # and store the ID of its indexer object homonymous_user.old_indexer_id = indexer_id - homonymous_user.show_in_list = True + homonymous_user.is_indexer = True homonymous_user.save() # if the indexer doesn't exist as a user else: @@ -69,7 +69,7 @@ def get_new_indexer(indexer_id): # the password can't be empty in login form, so they can't log in password="", old_indexer_id = indexer_id, - show_in_list=True, + is_indexer=True, ) diff --git a/django/cantusdb_project/main_app/tests/make_fakes.py b/django/cantusdb_project/main_app/tests/make_fakes.py index 38dcbe140..b374688a1 100644 --- a/django/cantusdb_project/main_app/tests/make_fakes.py +++ b/django/cantusdb_project/main_app/tests/make_fakes.py @@ -170,14 +170,14 @@ def make_fake_genre() -> Genre: return genre -def make_fake_user(show_in_list=True) -> get_user_model(): +def make_fake_user(is_indexer=True) -> get_user_model(): """Generates a fake User object.""" user = get_user_model().objects.create( full_name=f"{faker.first_name()} {faker.last_name()}", institution=faker.company(), city=faker.city(), country=faker.country(), - show_in_list=show_in_list, + is_indexer=is_indexer, email=f"{faker.lexify('????????')}@fakeemail.com", ) return user diff --git a/django/cantusdb_project/main_app/views/user.py b/django/cantusdb_project/main_app/views/user.py index 506c15b7c..172aa6a4f 100644 --- a/django/cantusdb_project/main_app/views/user.py +++ b/django/cantusdb_project/main_app/views/user.py @@ -96,7 +96,7 @@ class IndexerListView(SearchableListMixin, ListView): def get_queryset(self): all_users = super().get_queryset() - indexers = all_users.filter(show_in_list=True) + indexers = all_users.filter(is_indexer=True) display_unpublished = self.request.user.is_authenticated if display_unpublished: indexers = indexers.annotate( diff --git a/django/cantusdb_project/users/models.py b/django/cantusdb_project/users/models.py index 74e578d06..560b62286 100644 --- a/django/cantusdb_project/users/models.py +++ b/django/cantusdb_project/users/models.py @@ -15,9 +15,10 @@ class User(AbstractUser): email = models.EmailField(unique=True) # will be used to check if the user has changed the password assigned to them changed_initial_password = models.BooleanField(default=False) - # whether to display the user in the user-list page - show_in_list = models.BooleanField(default=False) - # if the user has a associated indexer object on old Cantus, save its ID + # whether the user has an associated indexer object on old Cantus + # if True, list the user in indexer-list page + is_indexer = models.BooleanField(default=False) + # if the user has an associated indexer object on old Cantus, save its ID old_indexer_id = models.IntegerField(blank=True, null=True) USERNAME_FIELD = 'email'