Skip to main content

A django module that allows to configure a global or model based database table prefix

Project description

Django Model Prefix

PyPI Test Status Codecov

A Django package that adds a global or model based database table prefix

Installation

Install using pip:

pip install django-model-prefix

Add model_prefix to your INSTALLED_APPS list. Make sure it is the first app in the list

INSTALLED_APPS = [
    'model_prefix',
    ...
]

Usage

Global table prefix

The global database table prefix can be configured using the DB_PREFIX setting

DB_PREFIX = "foo_"

Model table prefix

Optionally a model based prefix can also be defined by extending the models meta class

class Meta:
    db_prefix = "bar_"

This can be also used in order to disable the global prefix for a specific model

class Meta:
    db_prefix = None

Project details


Download files

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

Source Distribution

django-model-prefix-1.0.1.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

django_model_prefix-1.0.1-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page