0

I've written some piece of code I want to run using django-rq, i.e. use workers. I created a form where the user can chose several objects and press a button to start the operation. for this purpose I have in my views.py:

class ObjectOperationForm(forms.Form):
    objects=forms.ModelMultipleChoiceField(
        queryset=ModelName.objects.order_by('name'), required=True)

class ClusterOperation(FormView):
    form_class = ObjectOperationForm
    template_name = 'template.html'
    success_url = '/'

where should I add the piece of code to start executing the jobs using workers? Is it from one of the FormView's function? form_valid/dispatch ?

Mika R
  • 105
  • 1
  • 7
  • Presumably you only want to execute it when the form's valid. So, `form_valid` looks a good place to do it... (note that [ccbv](https://ccbv.co.uk/projects/Django/1.11/django.views.generic.edit/FormView/) is a handy site to jog your memory/summarise things) – Jon Clements Jun 04 '17 at 12:07
  • thanks! the class documentation is awesome ! – Mika R Jun 08 '17 at 07:27

0 Answers0