django-rq
django-rq copied to clipboard
Unable to call static method within the same class Model
python version: 2.7 django version: 1.10.6 django-rq version: 0.9.6.
Im unable to call a function inside a class. sample code
class SampleClass(models.Model):
@staticmethod
def my_function(data):
return things
@property
def push_function_to_worker(self):
queue = django_rq.get_queue('high')
data = {'data': 'things'}
queue.enqueue(SampleClass.my_function, data)
our work around is defining the function outside the class, which is kinda dirty but it works. Is there any cleaner way to do this. Thank you 👍
def my_function(data):
return things
class SampleClass(models.Model):
@property
def push_function_to_worker(self):
queue = django_rq.get_queue('high')
data = {'data': 'things'}
queue.enqueue(my_function, data)
Did you manage to find a workaround/cleaner way to do this without having to move the function out of the class?
I think I've got the same issue. But considering that I'm not using django-rq I think it might be an error related to rq in general :(