Code Monkey home page Code Monkey logo

django-check-admin's Introduction

django-check-admin

django-check-admin is a Django app that adds a system check to verify that all models have been registered with the Django admin site. This check is useful if all models of a project should normally be registered.

Installation

Install the package with pip:

$ pip install django-check-admin

Add 'checkadmin' to INSTALLED_APPS.

INSTALLED_APPS = [
    ...
    'checkadmin',
]

Running

Use the Django management command check:

$ python manage.py check

If a model is not registered with the Django admin site, an error will be emitted. For example:

The model myapp.MyModel is not registered with an admin site.

If specific models should be ignored by the check, use checkadmin.ignore() or define a list of ignored models in your settings with CHECK_ADMIN_IGNORED_MODELS:

import checkadmin
from myapp.models import MyModel

checkadmin.ignore(MyModel)
CHECK_ADMIN_IGNORED_MODELS = ["myapp.MyModel"]

Now, even if MyModel is not registered with an admin site, an error will not be emitted.

django-check-admin's People

Contributors

dizhakbot avatar francoisfreitag avatar jayvdb avatar jdufresne avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

django-check-admin's Issues

Fake admins

Fake admins often do not have all the usual attributes.
I have a few of them, and have gone through these problems with other meta apps, esp tolomea/django-data-browser#5

AttributeError: 'HaystackResultsAdmin' object has no attribute 'inlines'

Allow ignoring using settings

Needing to register the admin class requires importing the admin and models, which can be a bit tricky to get right for apps which I dont control the source code for.

Having a setting to list app.model or app.admin.AdminClass would be great.

LICENSE missing from PyPI sdist

It would also be nice to have tests in the sdist.

I can submit a PR if you want to use MANIFEST.in, but some people want to use other methods now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.