Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
BDE
nk20
Commits
a5e802f3
Commit
a5e802f3
authored
1 year ago
by
nicomarg
Browse files
Options
Downloads
Patches
Plain Diff
Improved the error message when trying to duplicate a Trust
parent
540f3bc3
No related branches found
No related tags found
1 merge request
!220
Rework of the friendships page
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/note/api/serializers.py
+4
-5
4 additions, 5 deletions
apps/note/api/serializers.py
with
4 additions
and
5 deletions
apps/note/api/serializers.py
+
4
−
5
View file @
a5e802f3
...
@@ -11,6 +11,7 @@ from member.models import Membership
...
@@ -11,6 +11,7 @@ from member.models import Membership
from
note_kfet.middlewares
import
get_current_request
from
note_kfet.middlewares
import
get_current_request
from
permission.backends
import
PermissionBackend
from
permission.backends
import
PermissionBackend
from
rest_framework.utils
import
model_meta
from
rest_framework.utils
import
model_meta
from
rest_framework.validators
import
UniqueTogetherValidator
from
..models.notes
import
Note
,
NoteClub
,
NoteSpecial
,
NoteUser
,
Alias
,
Trust
from
..models.notes
import
Note
,
NoteClub
,
NoteSpecial
,
NoteUser
,
Alias
,
Trust
from
..models.transactions
import
TransactionTemplate
,
Transaction
,
MembershipTransaction
,
TemplateCategory
,
\
from
..models.transactions
import
TransactionTemplate
,
Transaction
,
MembershipTransaction
,
TemplateCategory
,
\
...
@@ -86,11 +87,9 @@ class TrustSerializer(serializers.ModelSerializer):
...
@@ -86,11 +87,9 @@ class TrustSerializer(serializers.ModelSerializer):
class
Meta
:
class
Meta
:
model
=
Trust
model
=
Trust
fields
=
'
__all__
'
fields
=
'
__all__
'
validators
=
[
UniqueTogetherValidator
(
def
validate
(
self
,
attrs
):
queryset
=
Trust
.
objects
.
all
(),
fields
=
(
'
trusting
'
,
'
trusted
'
),
instance
=
Trust
(
**
attrs
)
message
=
_
(
"
You already have that person as a friend
"
))]
instance
.
clean
()
return
attrs
class
AliasSerializer
(
serializers
.
ModelSerializer
):
class
AliasSerializer
(
serializers
.
ModelSerializer
):
...
...
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