-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply "Merge branch 'development' into phillips/custom_parameters"
This reverts commit bc7cc0c.
- Loading branch information
Juan Puerto
committed
Jan 29, 2025
1 parent
bc7cc0c
commit 363d00d
Showing
15 changed files
with
597 additions
and
2 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
44 changes: 44 additions & 0 deletions
44
src/user_workspaces_server/migrations/0014_sharedworkspacemapping.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,44 @@ | ||
# Generated by Django 4.1.2 on 2025-01-06 19:36 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user_workspaces_server", "0013_alter_workspace_disk_space"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="SharedWorkspaceMapping", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID" | ||
), | ||
), | ||
("last_params", models.JSONField(blank=True, null=True)), | ||
("last_job_type", models.CharField(max_length=64, null=True)), | ||
( | ||
"original_workspace_id", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="original_workspace_set", | ||
to="user_workspaces_server.workspace", | ||
), | ||
), | ||
( | ||
"shared_workspace_id", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="shared_workspace_set", | ||
to="user_workspaces_server.workspace", | ||
), | ||
), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
src/user_workspaces_server/migrations/0015_sharedworkspacemapping_is_accepted.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,18 @@ | ||
# Generated by Django 4.1.2 on 2025-01-07 18:11 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user_workspaces_server", "0014_sharedworkspacemapping"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="sharedworkspacemapping", | ||
name="is_accepted", | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
...server/migrations/0016_rename_last_params_sharedworkspacemapping_last_resource_options.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,18 @@ | ||
# Generated by Django 4.2.17 on 2025-01-13 20:14 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user_workspaces_server", "0015_sharedworkspacemapping_is_accepted"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="sharedworkspacemapping", | ||
old_name="last_params", | ||
new_name="last_resource_options", | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
src/user_workspaces_server/migrations/0017_sharedworkspacemapping_datetime_share_created.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,22 @@ | ||
# Generated by Django 4.2.17 on 2025-01-14 15:58 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
( | ||
"user_workspaces_server", | ||
"0016_rename_last_params_sharedworkspacemapping_last_resource_options", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="sharedworkspacemapping", | ||
name="datetime_share_created", | ||
field=models.DateTimeField(null=True), | ||
preserve_default=False, | ||
), | ||
] |
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.contrib.auth.models import User | ||
from rest_framework import serializers | ||
|
||
from user_workspaces_server.models import SharedWorkspaceMapping, Workspace | ||
|
||
|
||
class UserSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = User | ||
fields = ["username", "first_name", "last_name", "email"] | ||
|
||
|
||
class WorkspaceSerializer(serializers.ModelSerializer): | ||
user_id = UserSerializer(read_only=True) | ||
|
||
class Meta: | ||
model = Workspace | ||
fields = Workspace.get_dict_fields() | ||
fields.append("user_id") | ||
|
||
def __init__(self, *args, **kwargs): | ||
workspace_type = kwargs.pop("workspace_type", None) | ||
super().__init__(*args, **kwargs) | ||
|
||
if workspace_type == "shared_workspace": | ||
for field_name in set(self.fields) - {"id", "user_id", "name", "description"}: | ||
self.fields.pop(field_name) | ||
|
||
|
||
class SharedWorkspaceMappingSerializer(serializers.ModelSerializer): | ||
original_workspace_id = WorkspaceSerializer(read_only=True, workspace_type="shared_workspace") | ||
shared_workspace_id = WorkspaceSerializer(read_only=True, workspace_type="shared_workspace") | ||
|
||
class Meta: | ||
model = SharedWorkspaceMapping | ||
exclude = ["id"] |
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
9 changes: 9 additions & 0 deletions
9
src/user_workspaces_server/templates/email_templates/example_share_email.txt
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,9 @@ | ||
Dear {{ receiver.first_name }} {{ receiver.last_name }}, | ||
|
||
{{ sharer.first_name }} {{ sharer.last_name }} would like to share their workspace with you. | ||
|
||
This workspace is called {{ original_workspace.name }} and is described as {{ original_workspace.description }}. | ||
|
||
Best regards, | ||
|
||
Data Portal Team |
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.