python - Django - Not posting form with crispy form and datatables -


i'm having trouble posting crispy form database. below views.py. awesome!

class customerview(xeditabledatatableview):         template_name = "customers.html"         model = customer         #datatable         datatable_options = {             'columns': [                         ("title", 'title'),                         ("name", 'poc', helpers.make_xeditable),                         ("email", 'pocemail', helpers.make_xeditable),                         ("location", 'location', helpers.make_xeditable),                         ("date added", 'dateadded', helpers.make_xeditable),                         ],             'hidden_columns': ['id'],                             }      #crispy form     def get_context_data(self, **kwargs):         context = super(customerview, self).get_context_data(**kwargs)         customer_form = customersform()         context['customer_form'] = customer_form         return context      #posting form     def post(self, request, *args, **kwargs):         if self.request.method == 'post':             customer_form = customersform(self.request.post)             if customer_form.is_valid():                 return httpresponseredirect(reverse('customerview'))         else:             customer_form = customersform()         return httpresponseredirect(reverse('customerview')) 

thanks help!

form.is_valid() validate form - have use validated data somehow. if customerform modelform, have call .save() method:

        if customer_form.is_valid():             customer_form.save()             return httpresponseredirect(reverse('customerview')) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -