Skip to main content

django admin extensions.

Project description

django-fastadmin

django admin extensions.

Install

pip install django-fastadmin

Usage

pro/settings.py

INSTALLED_APPS = [
    ...
    "django_static_jquery3",
    "django_static_ace_builds",
    "django_apiview",
    'django_fastadmin',
    ...
]
  • Add dependence package names in INSTALLED_APPS.

Installed Admin Extensions

Admin extends

  • UuidFieldSearchableAdmin
  • InlineBooleanFieldsAllowOnlyOneCheckedMixin
  • InlineUniqueChoiceFieldsMixin # @todo
  • DisableDeleteActionMixin
  • InlineEditingHideOriginalMixin
  • DisableInlineEditingInAddingMixin
  • DisableAddPermissionMixin
  • DisableDeletePermissionMixin
  • DisableChangePermissionMixin
  • MarkPermissionsMixin
  • TextFieldAutoHeightMixin
  • TextFieldSetRowColumnMixin
  • ResetToRandomPasswordField
  • EditablePasswordField
  • HideShowField
  • AddAdminViewHelper
  • ToggleFieldStateAdmin
  • SetTopModelAdmin
  • DjangoAdminGlobalMedia
  • DjangoWithExtraContextAdmin
  • DjangoDynamicMediaAdmin
  • HiddenFieldsAdmin
  • HideShowFieldsOnValueAdmin

Widgets

  • AceWidget
  • TitleToCodeWidget

Services

  • SimpleTaskService

Forms

Filters

admin.InlineBooleanFieldsAllowOnlyOneCheckedMixin Usage

  • django_static_jquery3 required in INSTALLED_APPS.
  • Add this mixin to inline class, and put it before TabularInline.
  • Add classes property
    • Add class InlineBooleanFieldsAllowOnlyOneCheckedMixin.special_class_name
    • Add class InlineBooleanFieldsAllowOnlyOneCheckedMixin.field_name_prefix + {field name},
  • Example:
    from django.contrib import admin
    from django_fastadmin.admin import InlineBooleanFieldsAllowOnlyOneCheckedMixin
    
    from .models import Book
    from .models import Category
    
    class BookInline(InlineBooleanFieldsAllowOnlyOneCheckedMixin, admin.TabularInline):
        model = Book
        extra = 0
        classes = [
            InlineBooleanFieldsAllowOnlyOneCheckedMixin.special_class_name,
            InlineBooleanFieldsAllowOnlyOneCheckedMixin.field_name_prefix + "is_best_seller",
            ]
    
    
    class CategoryAdmin(admin.ModelAdmin):
        inlines = [
            BookInline,
        ]
    
    admin.site.register(Category, CategoryAdmin)
    

widget.AceWidget Usage

  • django_static_jquery3 and django_static_ace_builds required in INSTALLED_APPS.
  • Create a model_form, and set the admin's form to the model_form.
  • Set the field to use AceWidget in the model_form.
  • Example:
class BookModelForm(forms.ModelForm):
    class Meta:
        model = Book
        fields = "__all__"
        widgets = {
            "description": AceWidget(ace_options={
                "mode": "ace/mode/yaml",
                "theme": "ace/theme/twilight",
            }),
        }

class BookAdmin(admin.ModelAdmin):
    form = BookModelForm
    list_display = ["title", "published"]

Bug report

Please report any issues at https://github.com/zencore-cn/zencore-issues.

Releases

v0.7.1 2020/11/08

  • Fix missing django-static-ace-builds problem.

v0.7.0 2020/10/27

  • Remove abstract models, so that django_fastadmin can forcus on admin extensions.
  • SimpleTask moved to django_simpletask.
  • SimplePublishModel and SimplePublishModelAdmin moved to django_simple_publish_model.

v0.6.2 2020/10/24

  • Fix DjangoWithExtraContextAdmin problem.

v0.6.1 2020/10/21

  • Upgrade django-db-lock, fix missing requests in setup problem.

v0.6.0 2020/10/13

  • Add admin.DjangoAdminGlobalMedia.
  • Add admin.DjangoWithExtraContextAdmin.
  • Add admin.DjangoDynamicMediaAdmin.
  • Add admin.HiddenFieldsAdmin.
  • Add admin.HideShowFieldsOnValueAdmin.
  • Add admin.DjangoObjectToolbarAdmin.
  • Add admin.DjangoSortableAdmin.
  • Add depends.

v0.5.0 2020/10/01

  • Add admin.AddAdminViewHelper.
  • Add admin.ToggleFieldStateAdmin.
  • Add admin.SimplePublishModelAdmin.
  • Add admin.SetTopModelAdmin.

v0.4.0 2020/09/23

  • Add widgets.TitleToCodeWidget.
  • Add models.SimplePublishModel.
  • Add many admin mixins.
  • Add app_requires.

v0.3.2 2020/09/08

  • Add SimpleTaskService.
  • Move service functions from model to service.
  • Upgrade django_db_lock depends.

v0.3.1 2020/09/01

  • Rename zh_hans to zh_Hans.
  • Depends on django-db-lock>=0.3.1.
  • Add django-static-xxx depends.

v0.3.0 2020/09/01

  • Change the directory structure of static files.
  • Add models.SimpleTask. It's an abstract model.
  • jQuery and jQuery plugins are moved to django-static-jquery3>=5.0.0.

v0.2.0 2020/08/25

  • Add widgets.AceWidget.

v0.1.1 2020/08/13

  • Fix jquery.js and jquery.init.js including orders, so that we don't need to change js plugin's source to use django.jQuery.

v0.1.0 2020/08/12

  • First release.
  • Add UuidFieldSearchableAdmin.
  • Add InlineBooleanFieldsAllowOnlyOneCheckedMixin.

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-fastadmin-0.7.1.tar.gz (23.1 kB view details)

Uploaded Source

File details

Details for the file django-fastadmin-0.7.1.tar.gz.

File metadata

  • Download URL: django-fastadmin-0.7.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for django-fastadmin-0.7.1.tar.gz
Algorithm Hash digest
SHA256 688118c531b26eaa91d2b006191dac7ca770429f425676bfcafafe88a86c247f
MD5 c13fb90138eab2eadfe1961fcd3ffecf
BLAKE2b-256 dd0965dcad5a6964b368515d0b4de50e25f3d58038dd32f4d2205eb1dad971f3

See more details on using hashes here.

Supported by

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