Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with atomic('core'):
- obj_qs = Demo.objects.filter(field_a=a, field_b=b)
- if finding_qs.count() > 0:
- raise ValidationError(detail="duplicate not allowed")
- demo = Demo(
- field_a= some_value ,
- fields_b = othre value
- )
- demo.save()
- return demo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement