-
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.
- Loading branch information
Showing
76 changed files
with
2,080 additions
and
827 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,6 @@ jobs: | |
black: false | ||
ruff: true | ||
|
||
frontend-check: | ||
name: "Frontend Check" | ||
uses: pennlabs/shared-actions/.github/workflows/[email protected] | ||
with: | ||
path: frontend | ||
nodeVersion: 20.11.1 | ||
|
||
build-backend: | ||
name: Build backend | ||
runs-on: ubuntu-latest | ||
|
@@ -79,7 +72,6 @@ jobs: | |
with: | ||
name: build-frontend | ||
path: /tmp/image.tar | ||
needs: frontend-check | ||
|
||
publish: | ||
name: Publish Images | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from django.conf import settings | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.auth.models import Group, Permission | ||
from django.contrib.contenttypes.models import ContentType | ||
from django.core.management.base import BaseCommand | ||
|
||
from clubs.models import Club | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Give superuser to hard-coded user accounts affiliated with OSA." | ||
web_execute = True | ||
|
||
def handle(self, *args, **kwargs): | ||
User = get_user_model() | ||
content_type = ContentType.objects.get_for_model(Club) | ||
approve_perm = Permission.objects.get( | ||
codename="approve_club", content_type=content_type | ||
) | ||
pending_perm = Permission.objects.get( | ||
codename="see_pending_clubs", content_type=content_type | ||
) | ||
if not settings.OSA_KEYS: | ||
raise ValueError("OSA_KEYS not set in settings") | ||
if not (approvers := Group.objects.filter(name="Approvers").first()): | ||
raise ValueError("Approvers group not found") | ||
for key in settings.OSA_KEYS: | ||
if not key or not (user := User.objects.get(username=key)): | ||
continue | ||
user.is_superuser = True | ||
user.is_staff = True | ||
user.user_permissions.add(approve_perm) | ||
user.user_permissions.add(pending_perm) | ||
approvers.user_set.add(user) | ||
user.save() | ||
approvers.save() |
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
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", | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
backend/clubs/migrations/0115_club_beta_historicalclub_beta.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,23 @@ | ||
# Generated by Django 5.0.4 on 2024-10-05 02:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("clubs", "0114_alter_advisor_public"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="club", | ||
name="beta", | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AddField( | ||
model_name="historicalclub", | ||
name="beta", | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
backend/clubs/migrations/0116_alter_club_approved_on_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,23 @@ | ||
# Generated by Django 5.0.4 on 2024-10-07 14:56 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("clubs", "0115_club_beta_historicalclub_beta"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="club", | ||
name="approved_on", | ||
field=models.DateTimeField(blank=True, db_index=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name="historicalclub", | ||
name="approved_on", | ||
field=models.DateTimeField(blank=True, db_index=True, null=True), | ||
), | ||
] |
42 changes: 42 additions & 0 deletions
42
backend/clubs/migrations/0117_clubapprovalresponsetemplate.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,42 @@ | ||
# Generated by Django 5.0.4 on 2024-10-16 02:18 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("clubs", "0116_alter_club_approved_on_and_more"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ClubApprovalResponseTemplate", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("title", models.CharField(max_length=255, unique=True)), | ||
("content", models.TextField()), | ||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="templates", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
), | ||
] |
Oops, something went wrong.