Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

django-tastypie-jqgrid

django-tastypie-jqgrid project aims to fill the gap between jqGrid and Tastypie for Django.

Currently it supports:

  • sorting
  • paging
  • toolbar filtering (except negated operators as for now)
  • JavaScript generation (no JS knowledge needed for basic usage)
  • form editing (editing in a popup)
    • modifying existing record
    • creating new records
    • deleting records
  • DatePicker integration (using DateColumn) please consider it pre-alpha release as for now. The source is being ported and cleaned from more complex project, it'll support more features soon (like negated filters, "prebuilt" filters and maybe more)

installation

It's pre-alpha release, yet it is supposed to be functional. The API might (and will) change a lot. If you do want to use it in the current version, the only way is to do hg clone http://bitbucket.org/migajek/django-tastypie-jqgrid

requirements

The code requires django-tastypie (current repository version, as of 2013-01-11, since the latest release - 0.9.11 - is a bit outdated.) Demo project requires Django 1.5, it should however be possible to run on older versions.

screenshots

django-tastypie-jqgrid screen django-tastypie-jqgrid screen

demo code

the code used for achieving the grid shown in the screenshot was as simple as: views.py:

class CustomPostsGridView(JqGridMixin, TemplateView):
    template_name = "posts.html"
    grid_resource = PostResource
    colmodel = [
        Column(name = 'id', label = '#', editable = False, width = 25),
        Column(name = 'title', label = _('Post title'), width = 230),
        Column(name = 'author_name', label = _('Author name'), width = 230),
        DateColumn(name = 'date_created', label = _('Date of publication'), width = 100, 
                    datepicker_edit = True, datepicker_search_tb = True),
        Column(name = 'body', label = _('Post body'), width = 430),
    ]

    filtering_toolbar = True
    columns_editable_by_default = True    
    pager_selector = '#gridpager'
    pager_options = {'search': False} # hidden search button

    def get_grid_options(self, user):
        return {                
                'scroll': False,
                'viewrecords': True
        }

template:

{% load jqgrid %}
{% block extra_head %}
    {% jqgrid_css_tags jquery_ui=True %}
    {% jqgrid_js_tags jquery_ui=True locale='pl'%}          
{% endblock %}
{% block content %} 
    <div class="wrapper">
        <table id="my-grid"></table>
        <div id="gridpager"></div> 
    </div>
    {% jqgrid_init "#my-grid" %}
{% endblock %}

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.