Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
bb25aee1
Verified
Commit
bb25aee1
authored
Jun 10, 2018
by
Sébastiaan Versteeg
Browse files
Fix push notification registration request
parent
a2a93ae3
Changes
2
Hide whitespace changes
Inline
Side-by-side
website/pushnotifications/api/serializers.py
View file @
bb25aee1
...
...
@@ -10,6 +10,7 @@ class DeviceSerializer(ModelSerializer):
receive_category
=
ManyRelatedField
(
allow_empty
=
True
,
required
=
False
,
child_relation
=
PrimaryKeyRelatedField
(
allow_empty
=
True
,
queryset
=
Category
.
objects
.
all
(),
required
=
False
)
...
...
website/pushnotifications/api/viewsets.py
View file @
bb25aee1
...
...
@@ -29,7 +29,8 @@ class DeviceViewSet(ModelViewSet):
)
except
Device
.
DoesNotExist
:
pass
if
len
(
serializer
.
validated_data
[
'receive_category'
])
>
0
:
data
=
serializer
.
validated_data
if
'receive_category'
in
data
and
len
(
data
[
'receive_category'
])
>
0
:
serializer
.
save
(
user
=
self
.
request
.
user
,
language
=
language
)
else
:
categories
=
[
c
.
pk
for
c
in
Category
.
objects
.
all
()]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment