Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datatables using procedures in django #219

Open
sumapreethi opened this issue Nov 8, 2018 · 0 comments
Open

datatables using procedures in django #219

sumapreethi opened this issue Nov 8, 2018 · 0 comments

Comments

@sumapreethi
Copy link

i am using django-datatables-view for displaying data in the Datatable. When i try to use this plugin with tables i got output as i needed.I have a procedure in MySQL. How can i use procedures in data tables in django.

in models.py

from django.db import connections
class MY_UTIL:
    def log_message(self):
        cur = connections["stats"].cursor()
        cur.callproc("USP_RPT_TOP_MOS",('2018-11-05',0))
        results = cur.fetchall()
        cur.close()
        return results 

in views.py:

class OrderJson(BaseDatatableView):          
    columns = ['Client','Operator','Circle','OA','DA','Message','SubmitTime']

    order_columns = ['Client','Operator','Circle','OA','DA','Message','SubmitTime']

    def get_initial_queryset(self):

        my_util = MY_UTIL()
        ret = my_util.log_message()     
        return ret  
    def render_column(self, row, column):
        return super(OrderJson, self).render_column(row, column)

when i try to do this its returning the following error TypeError: count() takes exactly one argument (0 given).procedure returns tuple here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant