mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
raise error if self.fields is empty
This commit is contained in:
parent
6eda634746
commit
4625266db6
|
@ -56,6 +56,8 @@ class WebsocketBinding(Binding):
|
|||
"""
|
||||
if self.fields == ['__all__']:
|
||||
self.fields = None
|
||||
elif not self.fields:
|
||||
raise ValueError("You must set the fields attribute on Binding %r!" % self.__class__)
|
||||
data = serializers.serialize('json', [instance], fields=self.fields)
|
||||
return json.loads(data)[0]['fields']
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user