python - Flask-Restless order_by related model -


I have these two models (defined by flask-SQLLame):

  class bank Account (Db.Model): id = db.Column (db.Integer, primary_key = true) customer_id = db.Column (db.Integer, db.ForeignKey ('customer.id')) created_at = db. Column (db.DateTime) class customer (db.model): id = db.Column (db.Integer, primary_key = true) name = db.Column (db.String (128), index = true)  < / Pre> 

I have no problem using the flask-rastless API EndPan for the bank account with the following query parameters:

  http://mywebsite.com/api / Bank_account? Q = {"order_by": [{"However, I would like to order these results (bank account) by the name of the customer - and the customer is that" customer "is a related model, There is no such area in the form of customer_name in the T model.  

Is there any easy way to work in this sequence? In some known Python ORM, this will be achieved using "double underscore" Something like:

  http://mywebsite.com/api/bank_account?q= {"order_by": I have also tried:  
  {" {"Field": "customer__name", "direction": "asc"}}   

: "customer", "direction": "acc"} {"field": "customer" "Direction": "ACC"} {"Field": "Customer.Name", "Direction": "ACC"}

All these For the efforts, I get this response:

  {"message": "Unable to create query"}   

How to create this query Even thoughts? Or is it not possible to just use Flask-Berhum? Thanks! Your best bet is to use a post processor:



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -