forked from 2i2c-org/frx-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request 2i2c-org#195 from jnywong/submission-level-access
Remove Teams and add submission collaborators
- Loading branch information
Showing
13 changed files
with
335 additions
and
210 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
61 changes: 61 additions & 0 deletions
61
...llenges/web/migrations/0031_remove_submission_team_remove_teammembership_team_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,61 @@ | ||
# Generated by Django 5.1.2 on 2024-11-22 17:20 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("web", "0030_evaluation_evaluator_logs"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="submission", | ||
name="team", | ||
), | ||
migrations.RemoveField( | ||
model_name="evaluation", | ||
name="evaluator_logs", | ||
), | ||
migrations.CreateModel( | ||
name="Collaborators", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("is_owner", models.BooleanField()), | ||
( | ||
"submission", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="web.submission" | ||
), | ||
), | ||
( | ||
"user", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
options={ | ||
"unique_together": {("user", "submission")}, | ||
}, | ||
), | ||
migrations.DeleteModel( | ||
name="Team", | ||
), | ||
migrations.DeleteModel( | ||
name="TeamMembership", | ||
), | ||
] |
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,18 @@ | ||
{% extends "page.html" %} | ||
{% load crispy_forms_tags %} | ||
{% block body %} | ||
<div class="container py-2"> | ||
<div class="row py-2"> | ||
<div class="col py-2"> | ||
<h1>Add collaborator to submission</h1> | ||
</div> | ||
<div class="col"> | ||
<a href="{% url 'submissions-detail' id %}" | ||
class="btn btn-primary m-2 float-end">Back to submission</a> | ||
</div> | ||
</div> | ||
<div class="row py-2"> | ||
<div class="col py-2">{% crispy form %}</div> | ||
</div> | ||
</div> | ||
{% endblock body %} |
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,68 @@ | ||
{% extends "page.html" %} | ||
{% block body %} | ||
<div class="container py-2"> | ||
<div class="row py-2"> | ||
<div class="col py-2"> | ||
<div class="row py-2"> | ||
<div class="col-6"> | ||
<h1>{{ submission.name }}</h1> | ||
{% if submission.description %}<p>{{ submission.description }}</p>{% endif %} | ||
</div> | ||
{% if is_submission_owner %} | ||
<div class="col-6"> | ||
<div class=" col"> | ||
<a href="{% url 'collaborators-add' submission.id %}" | ||
class="btn btn-secondary m-2 float-end">Add collaborator</a> | ||
</div> | ||
<div class=" col"> | ||
<a href="{% url 'submissions-detail' submission.id %}" | ||
class="btn btn-primary m-2 float-end">Back to submission</a> | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="container py-2"> | ||
{% if collaborators %} | ||
<div class="row py-2"> | ||
<div class="col-12"> | ||
<table class="table table-striped table-sm"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Collaborators</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for c in collaborators %} | ||
<tr> | ||
<td> | ||
<p> | ||
{{ c.user.username }} | ||
{% if c.is_owner %}<span>(submission owner)</span>{% endif %} | ||
</p> | ||
</td> | ||
<td> | ||
{% if is_submission_owner %} | ||
{% if not c.is_owner %} | ||
<a href={% url 'collaborators-delete' submission.id c.id %}>Remove</a> | ||
{% endif %} | ||
{% endif %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
{% else %} | ||
<div class="row py-2"> | ||
<div class="col"> | ||
<a href="" class="btn btn-secondary mt-2">Add collaborator</a> | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endblock body %} |
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.