Skip to content

Commit

Permalink
Readonly for mentors
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoest committed Jan 2, 2025
1 parent 11ccc87 commit 92d6912
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion S1/waitinglists/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@


class SessionAdmin(admin.ModelAdmin):
readonly_fields = ("attendance_done", "open_signup")
def get_readonly_fields(self, request, obj=None):
if request.user.groups.filter(name="Mentor").exists():
return ("attendance_done", "open_signup")
return super().get_readonly_fields(request, obj)

def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "mentor":
Expand Down

0 comments on commit 92d6912

Please sign in to comment.