Skip to main content

Django Admin CLI

https://travis-ci.org/ZuluPro/django-admin-cli.svg?branch=master https://coveralls.io/repos/ZuluPro/django-admin-cli/badge.svg?branch=master Code Health

Django third app for manage you models in command line environment.

Features

This app is based on Django Admin Site and ModelAdmin defined by developpers. It is supposed to allow user to make same things as in Admin site:

  • List model’s instance:

    • Filtering with Django’s Lookup

    • Choosing which field you want including ModelAdmin and Model attributes

    • Default display is the Admin one

  • Add an instance:

    • Prepopulate with default values

  • Update instances:

    • Filtering with Django’s Lookup

  • Delete instances:

    • Filtering with Django’s Lookup

  • Describe model and modeladmin

  • System user restriction (Read/Write)

  • Use admin actions (further)

Install

Install the package on your system:

pip install django-admin-cli

Add admin_cli to INSTALLED_APPS.

Usage

List model’s instance

$ ./manage.py cli user list
Username                      Email address                 First name                    Last name                     Staff status
zulu                                                                                                                    True
admin                                                                                                                   True

List specified fields

$ ./manage.py cli user list -f id -f username
Id                   Username
1                    zulu
2                    admin

Filter specified fields

$ ./manage.py cli user list -F id=1
Username                      Email address                 First name                    Last name                     Staff status
zulu                                                                                                                    True

Add an instance

$ ./manage.py cli site add -f domain=mysite.org -f 'name=My site'
Created 'mysite.org'

Update an instance

$ ./manage.py cli site update -F domain=mysite.org -f 'name=New name'
Update 'mysite.org' ? [Yes|No|All|Cancel] y
Updated 'mysite.org'

Delete an instance

$ ./manage.py cli site delete -F domain=mysite.org
Delete 'mysite.org' ? [Yes|No|All|Cancel] y
Deleted 'mysite.org'

Resctrict access to users

Put a dict named ADMIN_CLI_USERS in settings.py. It must have the following format:

ADMIN_CLI_USERS = {
  'login': 'RW',
}

Keys are UID or username, values are rights ‘R’ for read, ‘W’ for write/update/delete and ‘RW’ for both.

By default ADMIN_CLI_USERS is {} which allows all users to make all operations.

Testing

All tests are simply launched by:

python setup.py test

Online resources

Metadata

Release files for django-admin-cli 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-cli 0.1.1
File Size Uploaded Provenance Actions
django-admin-cli-0.1.1.tar.gz 11.2 kB Without provenance Details for django-admin-cli-0.1.1.tar.gz

Release files / django-admin-cli-0.1.1.tar.gz

Download URL django-admin-cli-0.1.1.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2440956f9b4456128a54289320ee79c00a7c44608f7784c1d23c263148e233a3
BLAKE2b-256 checksum
How to use checksums
f44b77e933a480b3f1592c12e6bf7c6f9a4ce9fda0414fdadd73d867cc236ae1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-admin-cli 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page