Skip to main content

Django Admin Generator is a management command to automatically generate a Django `admin.py` file for given apps/models.

Project description

Introduction

Test Status Coverage Status

The Django Admin Generator is a project which can automatically generate (scaffold) a Django Admin for you. By doing this it will introspect your models and automatically generate an Admin with properties like:

  • list_display for all local fields

  • list_filter for foreign keys with few items

  • raw_id_fields for foreign keys with a lot of items

  • search_fields for name and slug fields

  • prepopulated_fields for slug fields

  • date_hierarchy for created_at, updated_at or joined_at fields

Install

To install:

  1. Run pip install django-admin-generator-blokz or execute python setup.py install in the source directory

  2. Add django_admin_generator to your INSTALLED_APPS

If you want to run the tests, run py.test (requires pytest)

Usage

To generate an admin for a given app:

./manage.py admin_generator APP_NAME >> APP_NAME/admin.py

To generate an admin for a given app with all models starting with user:

./manage.py admin_generator APP_NAME ‘^user’ >> APP_NAME/admin.py

Publish to pypi

Now that the code for the python package is almost complete, you can start building the distribution archives.

First delete previous distributions:

rm -rf dist

Archives are compressed files that help your package to be deployed across multiple platforms and also make it platform independent.

In order to generate the distribution archives, run the following command from your terminal.

python3 -m pip install –user –upgrade setuptools wheel

This will upgrade your setuptools library on your machine to use the latest version. After this, you need to run the following command from the root directory of your package to generate the distribution files.

python3 setup.py sdist bdist_wheel

Once you run the above command, you can see that the distribution packages will be delivered under the directories — build and dist, that are newly created.

In addition to that, you can also see that the egg file information has been updated in the project source code as well.

Now that we have our distribution files ready, we can go ahead and try installing and importing the package to test if it works fine.

In order to install the package on your local machine, run the following command from the root directory.

python3 -m pip install –user -e .

Once the package is installed on local and works fine, it is now ready to be shipped to the PyPi repository.

Install a package called “twine” on your machine that will help ship the python package to the repositories.

python3 -m pip install –user –upgrade twine

Upload the package to PyPi. You can login with the project token set in PyPi. You can set the username to __token__ and the password to the access code saved earlier. You can also generate a new token.

python3 -m twine upload dist/*

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-admin-generator-blokz-1.1.3.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_generator_blokz-1.1.3-py2.py3-none-any.whl (13.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-admin-generator-blokz-1.1.3.tar.gz.

File metadata

  • Download URL: django-admin-generator-blokz-1.1.3.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2

File hashes

Hashes for django-admin-generator-blokz-1.1.3.tar.gz
Algorithm Hash digest
SHA256 ed3bb91d1d90d70e04f8a3ca3eeeb56ca39d3627bec0d376bafd64cefc656ae7
MD5 8533e994c8005933c7696622709ef35f
BLAKE2b-256 c601be3e151fe0a8ad18819729b0d1375fde8d4cc3d35310e79d2af4db43fa4f

See more details on using hashes here.

File details

Details for the file django_admin_generator_blokz-1.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: django_admin_generator_blokz-1.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2

File hashes

Hashes for django_admin_generator_blokz-1.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 076c74827f1c34595ff4037b17716c6231c99e8061b0da5b57bdbfe468295226
MD5 60a9a94fb2d691abf91a60ece2fdf3d0
BLAKE2b-256 501f6a22705c2aeff3ad2b31074b892db21bcfb8528378d3e1b9cc8ae93990fe

See more details on using hashes here.

Supported by

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