Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with DRF serializers for arches models #46

Merged
merged 6 commits into from
Nov 21, 2024
Merged
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
9 changes: 9 additions & 0 deletions arches_references/datatypes/datatypes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import uuid

from django.db.models.fields.json import JSONField
from django.utils.translation import get_language, gettext as _

from arches.app.datatypes.base import BaseDataType
Expand All @@ -9,6 +10,8 @@


class ReferenceDataType(BaseDataType):
rest_framework_model_field = JSONField(null=True)

def validate(
self,
value,
Expand Down Expand Up @@ -79,6 +82,12 @@ def validate(

def transform_value_for_tile(self, value, **kwargs):
list_id = kwargs.get("controlledList")
if (
isinstance(value, list)
and isinstance(value[0], dict)
and "value" in value[0]
):
value = value[0]["value"]
if isinstance(value, str):
found_item = self.lookup_listitem_from_label(value, list_id)
if found_item:
Expand Down
9 changes: 0 additions & 9 deletions arches_references/src/arches_references/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,3 @@ export interface MoveLabels {
moveDown: string;
changeParent: string;
}

// From PrimeVue, not importable directly
export interface FileContentProps {
files: [];
badgeSeverity: string;
badgeValue: string;
previewWidth: number;
templates: null;
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"arches @ git+https://github.com/archesproject/arches.git@dev/8.0.x",
"arches @ git+https://github.com/archesproject/arches.git@jtw/pythonic-resource-models",
"arches-vue-utils @ git+https://github.com/archesproject/arches-vue-utils.git@main",
]
version = "0.0.1"
Expand Down
1 change: 0 additions & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function generateConfig(): Promise<UserConfigExport> {
'**/themes/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'arches_references/constants.ts',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was hastily added in a prior PR but in another repo (lingo?) we've avoided making this change, so just bringing back in sync.

];

const rawData = fs.readFileSync(path.join(__dirname, '.frontend-configuration-settings.json'), 'utf-8');
Expand Down
Loading