-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filter to UserProfileListView (#1038)
* add filter to UserProfileListView * auto-overflow for qualification list * fix test * add default pagination size * deprecate relevant qualification categories preference * add show_with_user to category form * refactor getting qualification abbreviations * refactor qualification graph * only show essential qualifications * refactor QualificationUniverse * use contextvars * use QualificationUniverse in more places * userlist use qualification badges * restyle group list * fix DOM text reinterpreted as HTML * dont log permission changes on userprofile * left align user labels * add userlist tests * correct css order * address review * fix the graph * user singlemodelchoice fields in user filter * trim user list in group list view * better differentiation of top_level vs essential qualification * update is_management_group label/help text
- Loading branch information
1 parent
4750409
commit 567ae17
Showing
37 changed files
with
1,040 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
ephios/core/migrations/0020_qualificationcategory_show_with_user_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated by Django 4.2.4 on 2023-08-29 09:30 | ||
import logging | ||
|
||
from django.db import migrations, models | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def show_with_user_from_relevant_qualification_categories(apps, schema_editor): | ||
from dynamic_preferences.registries import global_preferences_registry | ||
|
||
global_preferences = global_preferences_registry.manager() | ||
relevant_categories_pks = { | ||
category.pk for category in global_preferences["general__relevant_qualification_categories"] | ||
} | ||
|
||
QualificationCategory = apps.get_model("core", "QualificationCategory") | ||
for category in QualificationCategory.objects.all(): | ||
category.show_with_user = category.pk in relevant_categories_pks | ||
logger.info(f"migrate {category.show_with_user=} for {category}") | ||
category.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0019_userprofile_user_email_ci_uniqueness"), | ||
("dynamic_preferences", "0005_auto_20181120_0848"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="qualificationcategory", | ||
name="show_with_user", | ||
field=models.BooleanField( | ||
default=True, | ||
verbose_name="Show qualifications of this category everywhere a user is presented.", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="userprofile", | ||
name="is_staff", | ||
field=models.BooleanField(default=False, verbose_name="Administrator"), | ||
), | ||
migrations.RunPython( | ||
show_with_user_from_relevant_qualification_categories, migrations.RunPython.noop | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.