The URL is as follows.
scheme://host:80/model_name/param1/param2/param3?order_by[]=field1%20acs&order_by[]=field2%20decs&limit=1&offset=2
The field specified in order_by is
I would like to determine if it matches the column name in the model_name (table).
FuelPHP can get model_name in \Uri::segment(1), but
Is there a method like this in Django?
Also, the model_name is designed to be linked to the table.
Methods that can retrieve column lists from ORM
Please let me know if anyone knows.
If you simply want to get a list of field names, I think you can get them below.
[f.name for fin MyModel._meta.get_fields()]
I think you can understand more by referring to the following.
https://docs.djangoproject.com/en/1.10/ref/models/meta/
© 2024 OneMinuteCode. All rights reserved.