def update(self, request, pk=None):
    if (pk.startswith('STATUS_') and hasattr(config, pk)):
        data = request.data
        new_status = data['status']
        setattr(config, pk, new_status)
        return Response({pk: new_status})
    elif (pk == 'SET_ALL'):
        status_keys = filter((lambda x: x.startswith('STATUS_')), constance.settings.CONFIG.keys())
        data = request.data
        new_status = data['status']
        for key in status_keys:
            setattr(config, key, new_status)
        return Response({'reset': 'complete'})
    else:
        raise Http404('Config does not exist')
def update(self, request, pk=None):
    if (pk.startswith('STATUS_') and hasattr(config, pk)):
        data = request.data
        new_status = data['status']
        setattr(config, pk, new_status)
        return Response({pk: new_status})
    elif (pk == 'SET_ALL'):
        status_keys = filter((lambda x: x.startswith('STATUS_')), constance.settings.CONFIG.keys())
        data = request.data
        new_status = data['status']
        for key in status_keys:
            setattr(config, key, new_status)
        return Response({'reset': 'complete'})
    else:
        raise Http404('Config does not exist')