Skip to content

Instantly share code, notes, and snippets.

@gerardo
Created June 14, 2011 02:36
Show Gist options
  • Save gerardo/1024205 to your computer and use it in GitHub Desktop.
Save gerardo/1024205 to your computer and use it in GitHub Desktop.
JQGrid + Django
def add_category(request):
result = {'success':False}
n_category = request.GET.get('n_category', None)
if n_category is not None:
new_cat = Category(name=n_category)
new_cat.save()
result = {'success':True, 'value':new_cat.id}
json = simplejson.dumps(result)
return HttpResponse(json, mimetype='application/json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment