File: features.py

package info (click to toggle)
python-django-pgtrigger 4.15.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 956 kB
  • sloc: python: 4,412; makefile: 114; sh: 8; sql: 2
file content (47 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from django.conf import settings


def model_meta():
    """
    True if model meta support is enabled
    """
    return getattr(settings, "PGTRIGGER_MODEL_META", True)


def schema_editor():
    """
    True if we are using the patched Postgres schema editor.

    Note that setting this to False means that we cannot easily
    alter columns of models that are associated with trigger
    conditions
    """
    return getattr(settings, "PGTRIGGER_SCHEMA_EDITOR", True)


def migrations():
    """
    True if migrations are enabled
    """
    return model_meta() and getattr(settings, "PGTRIGGER_MIGRATIONS", True)


def install_on_migrate():
    """
    True if triggers should be installed after migrations
    """
    return getattr(settings, "PGTRIGGER_INSTALL_ON_MIGRATE", False)


def schema():
    """
    The default schema where special objects are installed
    """
    return getattr(settings, "PGTRIGGER_SCHEMA", "public")


def prune_on_install():
    """
    True if triggers should be pruned on a full install or uninstall
    """
    return getattr(settings, "PGTRIGGER_PRUNE_ON_INSTALL", True)