Ticket #15238: patch.diff

File patch.diff, 1.6 KB (added by dgl, 4 years ago)

first patch

  • django/conf/global_settings.py

    diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
    index 0a45d75..7a128d9 100644
    a b STATICFILES_FINDERS = ( 
    583583# Make sure to use a trailing slash.
    584584# Examples: "http://foo.com/static/admin/", "/static/admin/".
    585585ADMIN_MEDIA_PREFIX = '/static/admin/'
     586
     587TABLE_PREFIX = None
  • django/db/models/options.py

    diff --git a/django/db/models/options.py b/django/db/models/options.py
    index 2f64c56..1bb32f4 100644
    a b class Options(object): 
    108108        # If the db_table wasn't provided, use the app_label + module_name.
    109109        if not self.db_table:
    110110            self.db_table = "%s_%s" % (self.app_label, self.module_name)
     111            if settings.TABLE_PREFIX:
     112                self.db_table = "%s_%s" % (settings.TABLE_PREFIX, self.db_table)
    111113            self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
    112114
    113115    def _prepare(self, model):
  • docs/ref/settings.txt

    diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
    index 8bf0a4e..b72eb92 100644
    a b It must end in a slash if set to a non-empty value. 
    16801680
    16811681See :setting:`STATIC_ROOT`.
    16821682
     1683.. setting:: TABLE_PREFIX
     1684
     1685TABLE_PREFIX
     1686----------
     1687
     1688Default: ``None``
     1689
     1690Prefix that will be added to all table names, if db_table property is not set
     1691explicitly.
     1692
     1693By default Django generates table name concatenating application name and
     1694model name. If not ``None``, this will be prepended to the result.
     1695
    16831696.. setting:: TEMPLATE_CONTEXT_PROCESSORS
    16841697
    16851698TEMPLATE_CONTEXT_PROCESSORS
Back to Top