Database

The django_marina.db module contains database related extensions.

class django_marina.db.models.ProtectedModelMixin[source]

Add checks to update and delete methods of an instance.

The use case is to protect against changes when update or delete is allowed for a user (superuser, admin or otherwise), but should not be executed because of objects that depend on this instance. In such a case, the foreign key relation to the model might benefit from on_delete=models.PROTECT.

class django_marina.db.migrations.DisableMigrations(*args, **kwargs)[source]

Settings class to disable migrations.

In your settings_test.py you can set MIGRATION_MODULES, for example:

from django_marina.db import DisableMigrations

if some_condition:
    MIGRATION_MODULES = DisableMigrations()