Skip to main content

No project description provided

Project description

Getting Started

Description

Admin custom filter package is a package will let you customize the view for the data in admin panel for each model dynamically.

Why this package has been developed ?

Basically when you want to add custom filters, custom searches, and custom list displays, You need to add the values you want in hard coded. But if someone uses the admin panel and he has no technical knowledge to update the code. He will ask the developer each time to update the codes and wait the development process to finish.

How this package will benefit ?

  1. The admin custom filter package will help to play around with all models' fields dynamically. So, any update in the filter will be reflected directly and immediately in the platform.
  2. Let say there are more than one admin in the platform, each one of them will have its unique filter. So, no overlap between them.

What you need to do ?

  1. Install the package
pip install admin-custom-filter
  1. Add the app name in installed apps in settings.py and configure the templates
    Make sure to have APP_DIRS to True and add BASE_DIR / "admin_custom_filter" / "templates" to DIRS list
INSTALLED_APPS = [
    'admin_custom_filter',
]
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            BASE_DIR / "admin_custom_filter" / "templates"
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
  1. After installing the package, make sure to have AUTH_USER_MODEL from the settings file.
EX:
inside settings.py
AUTH_USER_MODEL = "authentication.user"
  1. Run migration
python manage.py makemigrations
python manage.py migrate
OR
python3 manage.py makemigrations
python3 manage.py migrate
  1. Add the custom filter class to the models you want as the parent class inside admin.py file.
Ex:
from admin_custom_filter.models import CustomAdminFilter
class Countries(AdminCustomFilter):
    pass
  1. Save and go to the admin panel. Then select the model that has the admin custom filter.
  2. You will see button Custom filter.

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

admin_custom_filter-1.0.7.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

admin_custom_filter-1.0.7-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file admin_custom_filter-1.0.7.tar.gz.

File metadata

  • Download URL: admin_custom_filter-1.0.7.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for admin_custom_filter-1.0.7.tar.gz
Algorithm Hash digest
SHA256 e93f91e28e861acf94d44621360578a29e3800b8a5b7e387d5effb690f1236c4
MD5 d90e13c97daf293d6defecee4e3e745f
BLAKE2b-256 56a5f4883f1528a6c3b63f9c2787ad503110c0f0db122c5512cc7e327e2d6fe0

See more details on using hashes here.

File details

Details for the file admin_custom_filter-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for admin_custom_filter-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c7813add6944ab31eac3968b039e70ac4d2d9e78c37368e5a86bd8b4c08f3d7d
MD5 912481b08ea68e00fb1e10b629a1cde7
BLAKE2b-256 2e6e3cb1db83a860a4061b5870b1bb4c06b57b74247bb274077738bfff72f531

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