I have a class that uses a peewee model.
import peewee
class MyDatabase:
def __init__(self, database_filename):
self.db = peewee.SqliteDatabase(database_filename)
class BaseModel(peewee.Model):
class Meta:
database = self.db
class CustomModel(BaseModel):
my_int = peewee.IntegerField(default=0)
Now I want to document (using the Sphinx autoclass function) the CustomModel and I haven't found out what the best method should be.
Sure I could move CustomModel out of the MyDatabase class, but then I would need a global database variable which is not a good thing if I want to have this script importable. Any maybe the user wants to open multiple Sqlite database files, so a global database variable might be a bad idea and for this case the nested class structure should be the best, shouldn't it?