Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on May 29, 2012
Jonatan Alexis Anauati Removes dojango dependency.
Adds support for "lazy reversed" urls (see README file).
2b2bea1
Commits on Aug 14, 2012
@gerry Merge pull request #3 from jaanauati/master
removes dojango dependency.
21aa024
Showing with 14 additions and 10 deletions.
  1. +1 −2  README
  2. +13 −8 jqgrid.py
View
3  README
@@ -10,7 +10,6 @@ handler), and adding documentation/examples soon. Until then, you have been
warned!
== Prerequisites ==
- * [http://code.google.com/p/dojango/source/browse/trunk/dojango/util/__init__.py#97 json_encode]
* [http://www.jquery.com jQuery 1.3+]
* [http://www.trirand.com/blog/?page_id=6 jqGrid 3.5+]
@@ -22,7 +21,7 @@ warned!
class ExampleGrid(JqGrid):
model = SomeFancyModel # could also be a queryset
fields = ['id', 'name', 'desc'] # optional
- url = reverse('grid_handler')
+ url = reverse_lazy('grid_handler')
caption = 'My First Grid' # optional
colmodel_overrides = {
'id': { 'editable': False, 'width':10 },
View
21 jqgrid.py
@@ -34,8 +34,12 @@
from django.utils import simplejson as json
from django.utils.encoding import smart_str
from django.http import Http404
-from util.json import json_encode
+from dojango.util import json
+from django.core.serializers.json import DjangoJSONEncoder
+def json_encode(data):
+ encoder = DjangoJSONEncoder()
+ return encoder.encode(data)
class JqGrid(object):
queryset = None
@@ -187,12 +191,13 @@ def paginate_items(self, request, items):
def get_json(self, request):
paginator, page, items = self.get_items(request)
- return json_encode({
- 'page': page.number,
- 'total': paginator.num_pages,
- 'rows': items,
- 'records': paginator.count
- })
+ data={
+ 'page': int(page.number),
+ 'total': int(paginator.num_pages),
+ 'rows': [obj for obj in items],
+ 'records': int(paginator.count),
+ }
+ return json_encode(data)
def get_default_config(self):
config = {
@@ -220,7 +225,7 @@ def get_default_config(self):
return config
def get_url(self):
- return self.url
+ return str(self.url)
def get_caption(self):
if self.caption is None:

No commit comments for this range

Something went wrong with that request. Please try again.