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
e0c650a0
Commit
e0c650a0
authored
5 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Add true note name if we use an alias
parent
b6c31780
No related branches found
No related tags found
1 merge request
!57
Page de consommations
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/note/api/serializers.py
+12
-6
12 additions, 6 deletions
apps/note/api/serializers.py
apps/note/api/views.py
+1
-1
1 addition, 1 deletion
apps/note/api/views.py
templates/note/conso_form.html
+7
-2
7 additions, 2 deletions
templates/note/conso_form.html
with
20 additions
and
9 deletions
apps/note/api/serializers.py
+
12
−
6
View file @
e0c650a0
...
...
@@ -18,12 +18,6 @@ class NoteSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Note
fields
=
'
__all__
'
extra_kwargs
=
{
'
url
'
:
{
'
view_name
'
:
'
project-detail
'
,
'
lookup_field
'
:
'
pk
'
},
}
class
NoteClubSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -31,33 +25,45 @@ class NoteClubSerializer(serializers.ModelSerializer):
REST API Serializer for Club
'
s notes.
The djangorestframework plugin will analyse the model `NoteClub` and parse all fields in the API.
"""
name
=
serializers
.
SerializerMethodField
()
class
Meta
:
model
=
NoteClub
fields
=
'
__all__
'
def
get_name
(
self
,
obj
):
return
str
(
obj
)
class
NoteSpecialSerializer
(
serializers
.
ModelSerializer
):
"""
REST API Serializer for special notes.
The djangorestframework plugin will analyse the model `NoteSpecial` and parse all fields in the API.
"""
name
=
serializers
.
SerializerMethodField
()
class
Meta
:
model
=
NoteSpecial
fields
=
'
__all__
'
def
get_name
(
self
,
obj
):
return
str
(
obj
)
class
NoteUserSerializer
(
serializers
.
ModelSerializer
):
"""
REST API Serializer for User
'
s notes.
The djangorestframework plugin will analyse the model `NoteUser` and parse all fields in the API.
"""
name
=
serializers
.
SerializerMethodField
()
class
Meta
:
model
=
NoteUser
fields
=
'
__all__
'
def
get_name
(
self
,
obj
):
return
str
(
obj
)
class
AliasSerializer
(
serializers
.
ModelSerializer
):
"""
...
...
This diff is collapsed.
Click to expand it.
apps/note/api/views.py
+
1
−
1
View file @
e0c650a0
...
...
@@ -86,7 +86,7 @@ class NotePolymorphicViewSet(viewsets.ModelViewSet):
else
:
queryset
=
queryset
.
none
()
return
queryset
return
queryset
.
distinct
()
class
AliasViewSet
(
viewsets
.
ModelViewSet
):
...
...
This diff is collapsed.
Click to expand it.
templates/note/conso_form.html
+
7
−
2
View file @
e0c650a0
...
...
@@ -187,7 +187,10 @@
notes
+=
note
;
let
alias_obj
=
$
(
"
#alias_
"
+
alias
.
normalized_name
);
alias_obj
.
hover
(
function
()
{
$
(
"
#user_note
"
).
text
(
alias
.
name
+
"
:
"
+
pretty_money
(
note
.
balance
));
var
name
=
alias
.
name
;
if
(
name
!==
note
.
name
)
name
+=
"
(aka.
"
+
note
.
name
+
"
)
"
;
$
(
"
#user_note
"
).
text
(
name
+
"
:
"
+
pretty_money
(
note
.
balance
));
if
(
note
.
display_image
==
null
)
$
(
"
#profile_pic
"
).
attr
(
'
src
'
,
'
/media/pic/default.png
'
);
else
...
...
@@ -257,8 +260,8 @@
});
});
});
aliases_matched_obj
.
html
(
aliases_matched_html
);
});
aliases_matched_obj
.
html
(
aliases_matched_html
);
});
});
...
...
@@ -283,6 +286,8 @@
consos
=
[];
$
(
"
#note_list
"
).
html
(
""
);
$
(
"
#alias_matched
"
).
html
(
""
);
$
(
"
#profile_pic
"
).
attr
(
"
src
"
,
"
/media/pic/default.png
"
);
$
(
"
#user_note
"
).
text
(
""
);
refreshHistory
();
refreshBalance
();
});
...
...
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