.. _applications-model: .. module:: djpcms.views.appsite ====================== Model Application ====================== The Basics ========================= Lets assume we have a model called ``Project``, to setup a :ref:`djpcms application ` based on a database model, we create a class derived from :class:`ModelApplication`:: from djpcms.views import appsite class ProjectApplication(appsite.ModelApplication): pass A dynamic application is registered to the site by invoking:: appsite.site.register('/project/', Project, ProjectApplication) This application is pretty useless since it has no :class:`djpcms.views.appview.AppView` associated with it. Infact, such application will throw an :class:`djpcms.core.exceptions.ApplicationUrlException` because there are no views associated with it. Here is an ``app`` which can be used for something meaningful:: from djpcms.views import appsite, appview class ProjectApplication(appsite.ModelApplication): search = appview.SearchView() view = appview.ViewView() We can now search and view instances of ``Project``. .. _modelapplication-class: ModelApplication Class ========================= .. autoclass:: djpcms.views.appsite.ModelApplication :members: :inherited-members: :member-order: bysource