django-admin-shelf


Namedjango-admin-shelf JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/niltonfrederico/django-shelf
SummaryOrganize Django admin sections/models without additional apps
upload_time2025-07-22 14:02:29
maintainerNone
docs_urlNone
authorNilton Teixeira
requires_python>=3.11
licenseAGPL-3.0-or-later
keywords django admin organization plugin django-admin categories order
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![codecov](https://codecov.io/github/niltonfrederico/django-shelf/branch/main/graph/badge.svg?token=SATSBNDY0B)](https://codecov.io/github/niltonfrederico/django-shelf)
![pip](https://img.shields.io/pypi/v/django-admin-shelf
)

```
 ░▒▓███████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░▒▓█▓▒░      ░▒▓████████▓▒░
░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░
░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░
 ░▒▓██████▓▒░░▒▓████████▓▒░▒▓██████▓▒░ ░▒▓█▓▒░      ░▒▓██████▓▒░
       ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░
       ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░
░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░▒▓████████▓▒░▒▓█▓▒░
```

## Who?
**Django Shelf** is meant to be a simple way to categorize your model admins instead of relying on creating new apps for each category.

## Bu... but why?
The main reason is simply to avoid creating new apps for each category of model admins. This is especially useful if you got legacy applications that will break if you try to split them into new apps.

Yes, I know that this is not the best practice, but sometimes you just need to do it.

## How do I use it?
1. Install the package using `pip install django-admin-shelf`.
2. Add `admin_shelf` to your `INSTALLED_APPS` in your Django settings.
3. Create categories in your `admin.py` file as follows:

```python
from admin_shelf.admin import Category
from example.models import Model1

custom_category = Category(name="Custom Category")

@custom_category.register(Model1)
class Model1Admin(admin.ModelAdmin):
    pass
```

## A little piece of documentation

The `admin_shelf.admin.Category` class is used to create categories for your model admins. You can register your model admins to these categories using the `@category.register(Model)` decorator.

You can set a order for both the categories and the model admins by passing an `order` argument to the `Category` class and the `@register` decorator, respectively.

Example:

```python
from admin_shelf.admin import Category
from example.models import Model1, Model2

custom_category = Category(name="Custom Category", order=1)

@custom_category.register(Model1, order=2)
class Model1Admin(admin.ModelAdmin):
    pass

@custom_category.register(Model2, order=1)
class Model2Admin(admin.ModelAdmin):
    pass
```

Yes, it is just that simple. You can also use the `@register` decorator without passing a category, in which case it will be registered to the default category. Or use the default `register` from django admin if you want to register your model admin without a category.

Before shelf:
![Before using admin shelf](https://raw.githubusercontent.com/niltonfrederico/django-shelf/refs/heads/main/docs/assets/before-shelf.png)

After shelf:
![After using admin shelf](https://raw.githubusercontent.com/niltonfrederico/django-shelf/refs/heads/main/docs/assets/after-shelf.png)

## Anything else?

### Running the example app

To run the example app, you can use the following commands:
```bash
# You need to have docker installed
docker compose up example
```

### Running the tests
To run the tests, you can use the following commands:
```bash
# You need to have docker installed
docker compose up test
```

## How do I contribute?
If you want to contribute to this project, you can do so by creating an issue! And if you want to contribute with code, you can fork the repository and create a pull request.

Check the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information on how to contribute.

## Is it true that bananas are radioactive?
Yes.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/niltonfrederico/django-shelf",
    "name": "django-admin-shelf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "django, admin, organization, plugin, django-admin, categories, order",
    "author": "Nilton Teixeira",
    "author_email": "9078708+niltonfrederico@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/e3/5e/6836e43823d269a57c90f15089f76d6743083fedea25b02ff8d654372e0e/django_admin_shelf-0.1.2.tar.gz",
    "platform": null,
    "description": "[![codecov](https://codecov.io/github/niltonfrederico/django-shelf/branch/main/graph/badge.svg?token=SATSBNDY0B)](https://codecov.io/github/niltonfrederico/django-shelf)\n![pip](https://img.shields.io/pypi/v/django-admin-shelf\n)\n\n```\n \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\n\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591\n\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591\n \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\n       \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591\n       \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591      \u2591\u2592\u2593\u2588\u2593\u2592\u2591\n\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\n```\n\n## Who?\n**Django Shelf** is meant to be a simple way to categorize your model admins instead of relying on creating new apps for each category.\n\n## Bu... but why?\nThe main reason is simply to avoid creating new apps for each category of model admins. This is especially useful if you got legacy applications that will break if you try to split them into new apps.\n\nYes, I know that this is not the best practice, but sometimes you just need to do it.\n\n## How do I use it?\n1. Install the package using `pip install django-admin-shelf`.\n2. Add `admin_shelf` to your `INSTALLED_APPS` in your Django settings.\n3. Create categories in your `admin.py` file as follows:\n\n```python\nfrom admin_shelf.admin import Category\nfrom example.models import Model1\n\ncustom_category = Category(name=\"Custom Category\")\n\n@custom_category.register(Model1)\nclass Model1Admin(admin.ModelAdmin):\n    pass\n```\n\n## A little piece of documentation\n\nThe `admin_shelf.admin.Category` class is used to create categories for your model admins. You can register your model admins to these categories using the `@category.register(Model)` decorator.\n\nYou can set a order for both the categories and the model admins by passing an `order` argument to the `Category` class and the `@register` decorator, respectively.\n\nExample:\n\n```python\nfrom admin_shelf.admin import Category\nfrom example.models import Model1, Model2\n\ncustom_category = Category(name=\"Custom Category\", order=1)\n\n@custom_category.register(Model1, order=2)\nclass Model1Admin(admin.ModelAdmin):\n    pass\n\n@custom_category.register(Model2, order=1)\nclass Model2Admin(admin.ModelAdmin):\n    pass\n```\n\nYes, it is just that simple. You can also use the `@register` decorator without passing a category, in which case it will be registered to the default category. Or use the default `register` from django admin if you want to register your model admin without a category.\n\nBefore shelf:\n![Before using admin shelf](https://raw.githubusercontent.com/niltonfrederico/django-shelf/refs/heads/main/docs/assets/before-shelf.png)\n\nAfter shelf:\n![After using admin shelf](https://raw.githubusercontent.com/niltonfrederico/django-shelf/refs/heads/main/docs/assets/after-shelf.png)\n\n## Anything else?\n\n### Running the example app\n\nTo run the example app, you can use the following commands:\n```bash\n# You need to have docker installed\ndocker compose up example\n```\n\n### Running the tests\nTo run the tests, you can use the following commands:\n```bash\n# You need to have docker installed\ndocker compose up test\n```\n\n## How do I contribute?\nIf you want to contribute to this project, you can do so by creating an issue! And if you want to contribute with code, you can fork the repository and create a pull request.\n\nCheck the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information on how to contribute.\n\n## Is it true that bananas are radioactive?\nYes.\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0-or-later",
    "summary": "Organize Django admin sections/models without additional apps",
    "version": "0.1.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/niltonfrederico/django-shelf/issues",
        "Homepage": "https://github.com/niltonfrederico/django-shelf"
    },
    "split_keywords": [
        "django",
        " admin",
        " organization",
        " plugin",
        " django-admin",
        " categories",
        " order"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "051d3d365fef62e323fef5f461c200697800bad942d65554d9428b6832574db5",
                "md5": "410915394403de1999aab976f20c1932",
                "sha256": "58e401ed2ff6ed15a11385f6f7f7cb5c0bdf403f1a25718a19f4c21d68b48827"
            },
            "downloads": -1,
            "filename": "django_admin_shelf-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "410915394403de1999aab976f20c1932",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 18495,
            "upload_time": "2025-07-22T14:02:28",
            "upload_time_iso_8601": "2025-07-22T14:02:28.143507Z",
            "url": "https://files.pythonhosted.org/packages/05/1d/3d365fef62e323fef5f461c200697800bad942d65554d9428b6832574db5/django_admin_shelf-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e35e6836e43823d269a57c90f15089f76d6743083fedea25b02ff8d654372e0e",
                "md5": "0c5da832b3613c6763b7470491a7024a",
                "sha256": "bd18ef13692d6c5d0f76108d1f114dc6b00f8dbecbe472bc48c0f83335b88422"
            },
            "downloads": -1,
            "filename": "django_admin_shelf-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0c5da832b3613c6763b7470491a7024a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 22469,
            "upload_time": "2025-07-22T14:02:29",
            "upload_time_iso_8601": "2025-07-22T14:02:29.634377Z",
            "url": "https://files.pythonhosted.org/packages/e3/5e/6836e43823d269a57c90f15089f76d6743083fedea25b02ff8d654372e0e/django_admin_shelf-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-22 14:02:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "niltonfrederico",
    "github_project": "django-shelf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-admin-shelf"
}
        
Elapsed time: 0.71679s