-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide personal information for non-authenticated users on club page (#732
) Add granular visibility per advisor (admin, students, public) and hide question respondent names for unauthed view
- Loading branch information
1 parent
d3c7c9c
commit 245e557
Showing
13 changed files
with
195 additions
and
69 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
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 |
---|---|---|
|
@@ -455,7 +455,7 @@ def get_image(url): | |
department="Accounting Department", | ||
email="[email protected]", | ||
phone="+12158985000", | ||
defaults={"public": True}, | ||
defaults={"visibility": Advisor.ADVISOR_VISIBILITY_STUDENTS}, | ||
) | ||
|
||
club.tags.add(tag_undergrad) | ||
|
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,35 @@ | ||
# Generated by Django 5.0.4 on 2024-09-29 17:00 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_public_to_enum(apps, schema_editor): | ||
Advisor = apps.get_model("clubs", "Advisor") | ||
# Update 'public' field, assume public=True means only students by default | ||
Advisor.objects.filter(public=False).update(visibility=1) | ||
Advisor.objects.filter(public=True).update(visibility=2) | ||
|
||
def reverse_migrate_public_to_enum(apps, schema_editor): | ||
Advisor = apps.get_model("clubs", "Advisor") | ||
Advisor.objects.filter(visibility=1).update(public=False) | ||
Advisor.objects.filter(visibility__in=[2, 3]).update(public=True) | ||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("clubs", "0113_badge_message"), | ||
] | ||
operations = [ | ||
migrations.AddField( | ||
model_name="advisor", | ||
name="visibility", | ||
field=models.IntegerField( | ||
choices=[(1, "Admin Only"), (2, "Signed-in Students"), (3, "Public")], | ||
default=2, | ||
), | ||
), | ||
migrations.RunPython(migrate_public_to_enum, reverse_migrate_public_to_enum), | ||
migrations.RemoveField( | ||
model_name="advisor", | ||
name="public", | ||
), | ||
] |
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
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
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.