Django get app name from file
Instead of "guessing" the table name using the default convention you should use Model.objects.model._meta.db_table to get the real name.
A model can override the default table name convention and this will break your code reusability...
I need to execute some custom raw SQL in Django (1.9). Since tables in Django are prefixed with the app name I need to retrieve the app name. I want to use the same code in different apps later on, so I would like to get the app name in a soft coded way, just given the file the code resides in. What would be the best way to do this?