python - Django request.GET and jQuery Datatables -


With the data provided by the server, taking into account the example to fill the jQuery-Datatables table, a specific request The following forms are:

  http://www.datatables.net/examples/server_side/scripts/server_processing.php?draw=2&columns%5B0%5D%5Bdata%5D=0& ; Column% 5B0% 5D% 5Bname% 5D = & amp; Column% 5B0% 5D% 5Bsearchable% 5D = True & amp; Column% 5B0% 5D% 5Borderable% 5D = True & amp; Column% 5B0% 5D% 5Bsearch% 5D% 5Bvalue% 5D = & amp; Column% 5B0% 5D% 5Bsearch% 5D% 5Bregex% 5D = false & amp; Column% 5B1% 5D% 5Bdata% 5D = 1 & amp; Column% 5B1% 5D% 5Bname% 5D = & amp; Column% 5B1% 5D% 5Bsearchable% 5D = True & amp; Column% 5B1% 5D% 5Borderable% 5D = True & amp; Column% 5B1% 5D% 5Bsearch% 5D% 5Bvalue% 5D = & amp; Column% 5B1% 5D% 5Bsearch% 5D% 5Bregex% 5D = false & amp; Column% 5B2% 5D% 5Bdata% 5D = 2 & amp; Column% 5B2% 5D% 5Bname% 5D = & amp; Column% 5B2% 5D% 5Bsearchable% 5D = True & amp; Column% 5B2% 5D% 5Borderable% 5D = True & amp; Column% 5B2% 5D% 5Bsearch% 5D% 5Bvalue% 5D = & amp; Column% 5B2% 5D% 5Bsearch% 5D% 5Bregex% 5D = false & amp; Column% 5B3% 5D% 5Bdata% 5D = 3 and Col% 5B3% 5D% 5Bname% 5D = & amp; Column% 5B3% 5D% 5Bsearchable% 5D = True & amp; Column% 5B3% 5D% 5Borderable% 5D = True & amp; Column% 5B3% 5D% 5Bsearch% 5D% 5Bvalue% 5D = & amp; Column% 5B3% 5D% 5Bsearch% 5D% 5Bregex% 5D = false & amp; Column% 5B4% 5D% 5Bdata% 5D = 4 & amp; Column% 5B4% 5D% 5Bname% 5D = & amp; Column% 5B4% 5D% 5Bsearchable% 5D = True & amp; Column% 5B4% 5D% 5Borderable% 5D = True & amp; Column% 5B4% 5D% 5Bsearch% 5D% 5Bvalue% 5D = & amp; Column% 5B4% 5D% 5Bsearch% 5D% 5Bregex% 5D = false & amp; Column% 5B5% 5D% 5Bdata% 5D = 5 and Col% 5B5% 5D% 5Bname% 5D = & amp; Column% 5B5% 5D% 5Bsearchable% 5D = True & amp; Column% 5B5% 5D% 5Borderable% 5D = True & amp; Column% 5B5% 5D% 5Bsearch% 5D% 5Bvalue% 5D = & amp; Column% 5B5% 5D% 5Bsearch% 5D% 5Bregex% 5D = false & amp; Order% 5B0% 5D% 5Bcolumn% 5D = 0 & amp; Order% 5B0% 5D% 5Bdir% 5D = ASC & amp; Start = 10 & amp; Length = 10 & amp; Search% 5Bvalue% 5D = & amp; Search% 5Bregex% 5D = false & amp; _ = 1406235319463   

Which is the best way to handle such data, when Django is listening to client requests?

With legacy datasheet, I co-Uld easily deal with the request, by creating a form like the following and by filling it with the request. GET data, easy to handle verification and casting.

  class DataTablesForm (forms.Form): iDisplayStart = forms.IntegerField (MIN_VALUE = 0) iDisplayLength = forms.IntegerField (MIN_VALUE = -1) iSortingCols = forms.IntegerField (MIN_VALUE = 0, MAX_VALUE = 3) mDataProp_0 = forms.CharField () mDataProp_1 = forms.CharField () mDataProp_2 = forms.CharField () iSortCol_0 = forms.IntegerField (required = false, MIN_VALUE = 0, MAX_VALUE = 5) iSortCol_1 = forms.IntegerField (expected = false, MIN_VALUE = 0, MAX_VALUE = 5) iSortCol_2 = forms.IntegerField (required = false, MIN_VALUE = 0, MAX_VALUE = 5) sSortDir_0 = forms.ChoiceField (required = false, options = (( "ASC", "ASC") , ('' Description of '', 'desc')) sSortDir_1 = forms.ChoiceField (required = false, option = ('' ASK '' 'ACC'), ('' '' '' '' '' ' '))) SSortDir_2 = forms.ChoiceField Shayk = wrong, option = (('esk', 'ac'), ('desc', 'desc')) sEcho = forms.CharField (required = false)  

I think the problem is that how to deal with JSON formatted GPS data, if any "JSON formatted GET data" creates any

For this specific case I resolved in the following form:

  class DataTablesForm (forms.Form): Draw = forms. IntegerField () length = forms.IntegerField () start = forms.IntegerField () def __init __ (self, * args, ** kwargs): Super (DataTablesForm, self) to self .__ init__ (0, 3): ['Column [% d] [Data]'% i] = ('Args, ** Quargus'). ['_'] = Form. ['Column [% d] [Orderable]'% i ['column [% d] [Orderable]'% i) ['Column [% d] [Name]'% i] = Form. Formfold (required = fail)] = Forms.BooleanField (required = false) self.fields ['column [% d] [search] [regex]'% i] = forms Booleanfi ['column [% d] [search]'% ['column [% d] [search]'% ['column [% d] [search] [value]'% i] = forms. Field field (required = false ) I] = forms.BooleanField (required = false) self.fields [ 'command [% d] [column]'% i] = forms.IntegerField (required = false, Nuntm_man = 0, Max_value = 2) Selfkfields [ 'Order [% d] [dir]'% i] = form. Charjfild (required = false, options = (( 'ACC', 'ACC'), search [regex] '] = forms.BooleanField (required = false) self.fields [' search [value] '] = forms.BooleanField ( Required = false)    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -