title: How to redirect to a url when using modal forms in django
body: <p>Having a model (ProductSerialNumbers) which simulates a product with a serial number and after a successful implementation of the CRUD cycle with the aid of modal fm forms <a href="https://github.com/django-fm/django-fm" rel="nofollow noreferrer">https://github.com/django-fm/django-fm</a></p>
  
  <p>i face up the problem of unsuccessful redirection to other url after a successful delete of the object. The app keeps showing the modal fm window after clicking ok(for delete).</p>
  
  <p>How can i solve that to redirect to my list of ProductSerialNumbers?</p>
  
  <p>Here is my code of the view and a part of my template concerning the modal-delete.</p>
  
  <p><strong>view</strong></p>
  
  <pre><code>class ProductSerialNumbersDeleteView(LoginRequiredMixin, AjaxDeleteView):
      model = ProductSerialNumbers
      success_url = reverse_lazy('warehouse_stuffing')
  
      '''Function for deleting only the ProductSerialNuumbers which belong to an order, otherwise can not delete '''
      # Patch queryset to get the productSerialNumber
      def delete(self, request, *args, **kwargs):
          self.object = self.get_object()
          if (self.object.order):
              print("It belongs to an order, do not delete")
              return redirect('/warehouse_stuffing/')
          else:
              print("It is not in an order,delete")
              self.object.delete()
              print(self.success_url)
              return redirect('/warehouse_stuffing/')
  </code></pre>
  
  <p>seems that the redirect() function is not working properly.</p>
  
  <p><strong>template</strong></p>
  
  <pre><code> &lt;td&gt;&lt;a href="{% url 'warehouse_stuffing_delete' products_with_serial_numbers.id %}" class="fm-delete" data-fm-head="Delete of entry {{ products_with_serial_numbers }};" data-fm-callback="reload" &gt;&lt;button class="btn btn-danger btn-sm" type=""&gt;Delete&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;
  </code></pre>