Permalink
Browse files

Added support for custom config object

  • Loading branch information...
gerry committed May 28, 2011
1 parent 3dc0042 commit f48b53a9306dff4cc18e287445465a9a1cd123eb
Showing with 4 additions and 2 deletions.
  1. +4 −2 jqgrid.py
View
@@ -26,7 +26,7 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
#
import operator import operator
from django.db import models from django.db import models
from django.core.exceptions import FieldError, ImproperlyConfigured from django.core.exceptions import FieldError, ImproperlyConfigured
@@ -42,6 +42,7 @@ class JqGrid(object):
model = None model = None
fields = [] fields = []
allow_empty = True allow_empty = True
extra_config = {}
pager_id = '#pager' pager_id = '#pager'
url = None url = None
@@ -229,6 +230,7 @@ def get_caption(self):
def get_config(self, as_json=True): def get_config(self, as_json=True):
config = self.get_default_config() config = self.get_default_config()
config.update(self.extra_config)
config.update({ config.update({
'url': self.get_url(), 'url': self.get_url(),
'caption': self.get_caption(), 'caption': self.get_caption(),
@@ -237,7 +239,7 @@ def get_config(self, as_json=True):
if as_json: if as_json:
config = json_encode(config) config = json_encode(config)
return config return config
def lookup_foreign_key_field(self, options, field_name): def lookup_foreign_key_field(self, options, field_name):
'''Make a field lookup converting __ into real models fields''' '''Make a field lookup converting __ into real models fields'''
if '__' in field_name: if '__' in field_name:

0 comments on commit f48b53a

Please sign in to comment.