Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions backend/backend/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,22 @@ class MemberAdmin(UserAdmin):
admin.site.register(Application)
admin.site.register(Reference)
admin.site.register(Appointment)


class StudyProgramInline(admin.TabularInline):
model = StudyProgram
extra = 1


@admin.register(Section)
class SectionAdmin(admin.ModelAdmin):
list_display = ("abbreviation", "section_en", "section_sv")
search_fields = ("abbreviation", "section_en", "section_sv")
inlines = [StudyProgramInline]


@admin.register(StudyProgram)
class StudyProgramAdmin(admin.ModelAdmin):
list_display = ("name_en", "name_sv", "section")
search_fields = ("name_en", "name_sv", "section__abbreviation")
list_filter = ("section",)
21 changes: 21 additions & 0 deletions backend/backend/migrations/0006_role_role_description_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("backend", "0005_alter_team_logo"),
]

operations = [
migrations.AddField(
model_name="role",
name="role_description_url",
field=models.URLField(
blank=True,
default="",
help_text="Optional URL to a full role description",
verbose_name="Role description URL",
),
),
]
7 changes: 7 additions & 0 deletions backend/backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,13 @@ def role_type_to_level(role_type):
blank=False,
)

role_description_url = models.URLField(
verbose_name=_("Role description URL"),
help_text=_("Optional URL to a full role description"),
blank=True,
default="",
)

contact_email = models.EmailField(
verbose_name=_("Contact email address"),
help_text=_("The email address for the current position holder"),
Expand Down
6 changes: 6 additions & 0 deletions backend/backend/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class Meta:
"team_logo",
"title",
"description",
"role_description_url",
"contact_email",
]

Expand Down Expand Up @@ -153,6 +154,9 @@ def get_comment(self, obj):

def get_user_app_status(self, obj):
request = self.context.get("request")
if not request or not getattr(request.user, "is_authenticated", False):
return ""

application = obj.applications.filter(member=request.user).first()
status = ""
if application:
Expand Down Expand Up @@ -293,13 +297,15 @@ class ApplicationSerializer(ModelSerializer):
class Meta:
model = Application
fields = [
"id",
"position",
"cover_letter",
"qualifications",
"gdpr",
"status",
"references",
]
read_only_fields = ["id"]

def validate(self, data):
"""Validate application data"""
Expand Down
17 changes: 14 additions & 3 deletions backend/backend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,13 @@ class PositionViewSet(ReadOnlyModelViewSet):

def list(self, request):
"""Return both open positions and user's positions"""
if request.user.is_authenticated:
my_positions = Position.objects.for_member(request.user).select_related(
"role", "role__team"
)
else:
my_positions = Position.objects.none()

my_positions = Position.objects.for_member(request.user).select_related(
"role", "role__team"
)
open_positions = Position.objects.open_positions().select_related(
"role", "role__team"
)
Expand Down Expand Up @@ -594,6 +597,14 @@ def post(self, request):

return Response(serializer.errors, status=400)

def delete(self, request):
user = request.user

logout(request)
user.delete()

return Response({"message": "Account deleted successfully"}, status=200)


class UnicoreDataAPIView(APIView):
def get(self, request):
Expand Down
36 changes: 0 additions & 36 deletions frontend/apply/README.md

This file was deleted.

3 changes: 3 additions & 0 deletions frontend/apply/public/icons/check-blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading