Skip to main content
django_db_prefix
================

Project goal
------------

Allow specification of a global database table name prefix.

Reason for the project
----------------------

1. Some (external) projects automatically use a database prefix for
interaction with a database. This is particularly common in implementations
of the Active Record pattern.

2. It is possible to define an explicit database table name in the Meta
class on a model; however, this is not as easily accomplished when dealing
with a third-party application. By providing a high-level interface for
adding prefixes there is a simple, consistent way to achieve this goal other
than forking the code or ad-hoc monkey patching.

Installation
------------

1. Install using pip:

pip install django-db-prefix

2. Add django_db_prefix at the top of your INSTALLED_APPS list. It is
recommended that django_db_prefix is the first listed application, but it
is essential that it be loaded before the initialization of any model you
expect to be modified.

INSTALLED_APPS = ['django_db_prefix',] + INSTALLED_APPS

Configuration
-------------


Global Prefix
=============

To add a common prefix to all models simply set `DB_PREFIX` to the string that
you want to be prepended.

DB_PREFIX = "foo_"

For example, for the model bar_app.models.Baz the default table would be:
`bar_app_baz`

By setting `DB_PREFIX` to `foo_`, the table would be `foo_bar_app_baz`.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-db-prefix-1.0.3.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file django-db-prefix-1.0.3.tar.gz.

File metadata

File hashes

Hashes for django-db-prefix-1.0.3.tar.gz
Algorithm Hash digest
SHA256 fad493a4f4190a507647018186b504d67df96ba1989c2730d6bc776224d57772
MD5 7d3578a45cb27091484a3cce2d8363f5
BLAKE2b-256 0691781aadb866552a43694a676fd5b113fe2fc664317d75569b4f5a9b47bf68

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.5

1 file

1.0.4

1 file

This release

1.0.3 This release

1 file

1.0.2

1 file

1.0.1

1 file

1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page