Example #1
0
    def camelize_string(self, s):
        """Hack to force ``djangorestframework_camel_case`` to camelize a plain string.

        :param str s: the string
        :return: camelized string
        :rtype: str
        """
        return next(iter(camelize({s: ''})))
Example #2
0
def notify_group(group, message):
    """
    Dumps the message to JSON and sends it to the specified channel.

    :param group: str
    :param message: dict
    """
    channel_layer = get_channel_layer()
    payload = json.dumps(camelize(message))
    return AsyncToSync(channel_layer.group_send)(group, {
        "type": "notification.message",
        "text": payload
    })
Example #3
0
 def camelize_string(s):
     """Hack to force ``djangorestframework_camel_case`` to camelize a plain string."""
     return next(iter(camelize({s: ''})))