Skip to main content

A simple Django app to create refactor output of inspectdb command into separate classes.

Project description

[![PyPI version](https://badge.fury.io/py/django-inspectdb-refactor.svg)](https://badge.fury.io/py/django-inspectdb-refactor)

Django Inspectdb Refactor
========================
A simple utility command based on django inspectdb management command.

Overview:
---------

Django's ``inspectb`` command prepares database models classes based on existing database.
This is very handy tool, in case we have to work on some already existing database.

It outputs the classes to standard output, which can be pipelined to a python file.

But when you have a large database, containing hundreds of tables, the models file becomes too large. It is better to write ``separate model file for each table`` and keep that under models folder inside the app directory. Django will get the model classes from the ``init`` file you write inside the models folder.
Same holds for admin, views and forms.

Django Inspectdb Refactor will automatically create the required folders and create separate python files for each model.


Requirements:
-----------
Requires Django version >= 1.9

Installation:
------------
You can install it via pip or to get the latest version clone this repo.

`
pip install django-inspectdb-refactor
`

Add ``inspectdb_refactor`` to your ``INSTALLED_APPS`` inside settings.py of your project.

Usage:
-----
The command accepts two command line arguments:

- ``app`` : This is a required argument. You need to provide app_label in order to
make models in that particular app.
- ``database``: To specify a particular database. Otherwise picks default from settings.

For example, If you have an app called ``products`` and database ``product_db`` then

`
python manage.py inspectdb_refactor --database=product_db --app=products
`


License:
--------
Django Inspectdb Refactor is an Open Source project licensed under the terms of the BSD3 license.



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-inspectdb-refactor-0.4.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

django_inspectdb_refactor-0.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file django-inspectdb-refactor-0.4.tar.gz.

File metadata

  • Download URL: django-inspectdb-refactor-0.4.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.5.2

File hashes

Hashes for django-inspectdb-refactor-0.4.tar.gz
Algorithm Hash digest
SHA256 b55e191dbb7dfc048e1df564cf170cfe3860cb961310e0373f0cbfedd8c952e6
MD5 fb0fd204936a62999f7bd2d8149793a4
BLAKE2b-256 9652e1e3f33ef9b6f4dda41d8c83eb90d4030531dbd44ba46dd9555c7c5d1f17

See more details on using hashes here.

File details

Details for the file django_inspectdb_refactor-0.4-py3-none-any.whl.

File metadata

  • Download URL: django_inspectdb_refactor-0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.5.2

File hashes

Hashes for django_inspectdb_refactor-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9f064b7e386f99321cc73ba87ae4200682622e2044c7376e624c3678c325fc49
MD5 bc2d9eb0398799e445cb253a72dca665
BLAKE2b-256 45f982d1c1e57d90dc5242b37d1ade93dd95eefc34b82b99f7aed80ea8f8caf2

See more details on using hashes here.

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