Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
99
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp
Commits
5cc8014f
Commit
5cc8014f
authored
5 years ago
by
Jean-Baptiste
Browse files
Options
Downloads
Patches
Plain Diff
update: set default depth to 0
parent
5ce49f46
No related branches found
No related tags found
1 merge request
!81
Resolve "Split LDPSerializer (Read / write)"
Pipeline
#1007
passed with stage
Stage: test
in 1 minute and 20 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
djangoldp/models.py
+1
-1
1 addition, 1 deletion
djangoldp/models.py
djangoldp/serializers.py
+0
-16
0 additions, 16 deletions
djangoldp/serializers.py
djangoldp/tests/runner.py
+1
-1
1 addition, 1 deletion
djangoldp/tests/runner.py
djangoldp/tests/tests_temp.py
+0
-1
0 additions, 1 deletion
djangoldp/tests/tests_temp.py
with
2 additions
and
19 deletions
djangoldp/models.py
+
1
−
1
View file @
5cc8014f
...
@@ -65,7 +65,7 @@ class Model(models.Model):
...
@@ -65,7 +65,7 @@ class Model(models.Model):
class
Meta
:
class
Meta
:
default_permissions
=
(
'
add
'
,
'
change
'
,
'
delete
'
,
'
view
'
,
'
control
'
)
default_permissions
=
(
'
add
'
,
'
change
'
,
'
delete
'
,
'
view
'
,
'
control
'
)
abstract
=
True
abstract
=
True
depth
=
1
depth
=
0
@classonlymethod
@classonlymethod
def
resolve_id
(
cls
,
id
):
def
resolve_id
(
cls
,
id
):
...
...
This diff is collapsed.
Click to expand it.
djangoldp/serializers.py
+
0
−
16
View file @
5cc8014f
...
@@ -238,8 +238,6 @@ class LDPSerializer(HyperlinkedModelSerializer):
...
@@ -238,8 +238,6 @@ class LDPSerializer(HyperlinkedModelSerializer):
return
data
return
data
def
build_field
(
self
,
field_name
,
info
,
model_class
,
nested_depth
):
def
build_field
(
self
,
field_name
,
info
,
model_class
,
nested_depth
):
nested_depth
=
self
.
compute_depth
(
nested_depth
,
model_class
)
return
super
().
build_field
(
field_name
,
info
,
model_class
,
nested_depth
)
return
super
().
build_field
(
field_name
,
info
,
model_class
,
nested_depth
)
def
build_property_field
(
self
,
field_name
,
model_class
):
def
build_property_field
(
self
,
field_name
,
model_class
):
...
@@ -318,7 +316,6 @@ class LDPSerializer(HyperlinkedModelSerializer):
...
@@ -318,7 +316,6 @@ class LDPSerializer(HyperlinkedModelSerializer):
return
type
(
field_class
.
__name__
+
'
Valued
'
,
(
JSonLDStandardField
,
field_class
),
{}),
field_kwargs
return
type
(
field_class
.
__name__
+
'
Valued
'
,
(
JSonLDStandardField
,
field_class
),
{}),
field_kwargs
def
build_nested_field
(
self
,
field_name
,
relation_info
,
nested_depth
):
def
build_nested_field
(
self
,
field_name
,
relation_info
,
nested_depth
):
nested_depth
=
self
.
compute_depth
(
nested_depth
,
self
.
Meta
.
model
)
class
NestedLDPSerializer
(
self
.
__class__
):
class
NestedLDPSerializer
(
self
.
__class__
):
...
@@ -390,23 +387,10 @@ class LDPSerializer(HyperlinkedModelSerializer):
...
@@ -390,23 +387,10 @@ class LDPSerializer(HyperlinkedModelSerializer):
kwargs
[
'
required
'
]
=
False
kwargs
[
'
required
'
]
=
False
return
NestedLDPSerializer
,
kwargs
return
NestedLDPSerializer
,
kwargs
@classmethod
def
compute_depth
(
cls
,
depth
,
model_class
,
name
=
'
depth
'
):
try
:
model_depth
=
getattr
(
model_class
.
_meta
,
'
depth
'
,
getattr
(
model_class
.
Meta
,
'
depth
'
,
10
))
depth
=
min
(
depth
,
int
(
model_depth
))
except
AttributeError
:
depth
=
min
(
depth
,
int
(
getattr
(
model_class
.
_meta
,
'
depth
'
,
1
)))
return
depth
@classmethod
@classmethod
def
many_init
(
cls
,
*
args
,
**
kwargs
):
def
many_init
(
cls
,
*
args
,
**
kwargs
):
kwargs
[
'
child
'
]
=
cls
(
**
kwargs
)
kwargs
[
'
child
'
]
=
cls
(
**
kwargs
)
try
:
cls
.
Meta
.
depth
=
cls
.
compute_depth
(
kwargs
[
'
context
'
][
'
view
'
].
depth
,
cls
.
Meta
.
model
,
'
depth
'
)
except
KeyError
:
pass
return
ContainerSerializer
(
*
args
,
**
kwargs
)
return
ContainerSerializer
(
*
args
,
**
kwargs
)
def
get_value
(
self
,
dictionary
):
def
get_value
(
self
,
dictionary
):
...
...
This diff is collapsed.
Click to expand it.
djangoldp/tests/runner.py
+
1
−
1
View file @
5cc8014f
...
@@ -63,7 +63,7 @@ failures = test_runner.run_tests([
...
@@ -63,7 +63,7 @@ failures = test_runner.run_tests([
'
djangoldp.tests.tests_auto_author
'
,
'
djangoldp.tests.tests_auto_author
'
,
'
djangoldp.tests.tests_get
'
,
'
djangoldp.tests.tests_get
'
,
'
djangoldp.tests.tests_delete
'
,
'
djangoldp.tests.tests_delete
'
,
'
djangoldp.tests.tests_temp
'
#
'djangoldp.tests.tests_temp'
])
])
if
failures
:
if
failures
:
...
...
This diff is collapsed.
Click to expand it.
djangoldp/tests/tests_temp.py
+
0
−
1
View file @
5cc8014f
...
@@ -18,4 +18,3 @@ class TestTemp(TestCase):
...
@@ -18,4 +18,3 @@ class TestTemp(TestCase):
pass
pass
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment