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
ae8652a3
Commit
ae8652a3
authored
4 years ago
by
Calum Mackervoy
Committed by
Benoit Alessandroni
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: Serializer.create completed in a transaction
parent
236e2055
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
djangoldp/serializers.py
+4
-3
4 additions, 3 deletions
djangoldp/serializers.py
with
4 additions
and
3 deletions
djangoldp/serializers.py
+
4
−
3
View file @
ae8652a3
...
...
@@ -8,6 +8,7 @@ from django.conf import settings
from
django.contrib.auth
import
get_user_model
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.exceptions
import
ValidationError
as
DjangoValidationError
from
django.db
import
transaction
from
django.urls
import
resolve
,
Resolver404
,
get_script_prefix
from
django.urls.resolvers
import
get_resolver
from
django.db.models
import
QuerySet
...
...
@@ -588,9 +589,9 @@ class LDPSerializer(HyperlinkedModelSerializer):
return
super
().
get_value
(
dictionary
)
def
create
(
self
,
validated_data
):
instance
=
self
.
internal_create
(
validated_data
,
model
=
self
.
Meta
.
model
)
self
.
attach_related_object
(
instance
,
validated_data
)
with
transaction
.
atomic
():
instance
=
self
.
internal_create
(
validated_data
,
model
=
self
.
Meta
.
model
)
self
.
attach_related_object
(
instance
,
validated_data
)
return
instance
...
...
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