Jump to >

Database ModelsΒΆ

Extensions are able to provide Django Models, which are database tables under the control of the extension. Review Board handles registering these models, creating the database tables, and performing any database schema migrations the extension defines.

Extensions use the same convention as Django apps when defining Models. In order to define new Models, a models.py file, or a models/ directory constituting a Python package needs to be created.

Here is an example models.py file:

from django.db import models


class MyExtensionsSampleModel(models.Model):
    name = models.CharField(max_length=128)
    enabled = models.BooleanField(default=False)

See the Django Models documentation for more information on how to write a model, and Django Evolution for information on how to write database schema migrations.

Note

When an extension is disabled, tables for its models remain in the database. These should generally not interfere with anything.