Saravanan666/pypi-org huggingface dataset:
Package: django-admin-column-toggle
Django Admin Column ToggleDjango Admin Column Toggle is a reusable Django package that adds column toggle functionality to the Django admin interface. This allows users to show or hide columns in the list view of the Django admin site.InstallationInstall the package:With poetrypoetry add django-admin-column-toggleWith pippip install django-admin-column-toggleAdd 'column_toggle' to your `INSTALLED_APPS` setting in your Django project:INSTALLED_APPS=[...'column_toggle',]UsageImport `ColumnToggleModelAdmin` from `column_toggle.admin` and inherit it in your `ModelAdmin` class. For example:fromdjango.contribimportadminfromcolumn_toggle.adminimportColumnToggleModelAdminfrom.modelsimportYourModel@admin.register(YourModel)classYourModelAdmin(ColumnToggleModelAdmin):list_display=('field1','field2','field3')To set the default selected columns, add the `default_selected_columns` attribute in your `ModelAdmin` class:@admin.register(YourModel)classYourModelAdmin(ColumnToggleModelAdmin):list_display=('field1','field2','field3')default_selected_columns=['field1','field2']By doing this, only the specified columns ('field1' and 'field2' in this example) will be visible by default. Users can still toggle the visibility of other columns manually.That's it! Now you should have column toggle functionality in the Django admin list view for the specified model.ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.LicenseMIT
Package: django-admin-commands
A super simple library to allow admins to run Django management commands at panel. This saves admins from the hassle of ssh’ing into the servers, also gives more auditability since all the runtimes, commands, and outputs will be captured in the admin panel.To understand the design decisions you can read the following blog posts where I justify the need for these cases.https://eralpbayraktar.com/blog/django/2022/Getting It$ pip install django-admin-commandsUsageAdd admincommands to your INSTALLED_APPS in settings.py.Run ./manage.py migrate to have the CommandRunInstance created in your database.(Optional) Allow granular access who can run/delete/view command run instances using Django’s permissions system.
Package: django-admin-commands2
Because sometimes you want to give teh admin access to some commands. This app allows you to specify the commands you want to allow the admin to execute. It also logs the commands executed and the output of the command.FeaturesSpecify the commands you need to allow for admin to execute. (Or explicitly choose all)Get the logs, stdout, stderr in admin.Easy permissionsEasily customizable to use django-rq or other queueing techniqueInstallationInstall directly from repopip install git+https://github.com/KUWAITNET/django-admin-commands#egg=django-admin-commands2Install from pypiUse the package managerpipto install django-admin-commands2.There is a package with the same name on pypi , hence the 2 suffixpip install django-admin-commands2Addadmin_commandsto yourINSTALLED_APPSpython manage.py migrateUsageAdds the commands you need to allow to the admin to your settings. Example:# settings.pyADMIN_COMMANDS_CONFIG={'allowed_commands':['ping_google',# command name('update_index','--no-input')# you can also pass arguments to the command,]# You can also use the following to allow all commands# 'allowed_commands': 'all''use_django_rq':True,# If you want to use django-rq to execute the commands, default is False}Navigate to the admin site and you will see a new section calledManagement Commandswith commands to execute and see their logsPermissionsApp comes with 2 permissionsCan execute management commandswhich is required to access & execute commands allowed.View other users logwhich is allow the user to see the logs of other users ran commands. If Not given, logs will be filtered to own records only.CustomizationYou can override the admin class for ManagementCommandsAdmin to customize the admin view.# admin.pyfromadmin_commands.adminimportCommandAdminBase,ManagementCommandAdminfromadmin_commands.modelsimportManagementCommandsclassCustomManagementCommandsAdmin(ManagementCommandAdmin):defexecute_command_and_return_response(self,request,command,args):# Easy Entry point to customize execution,importdjango_rqdjango_rq.enqueue(command.execute,request.user,args)# OR without django_rqcommand.execute(request.user,args)self.message_user(request,_('Command executed'))returnself.response_post_save_add(request,command)defexecute_command_view(self,request,object_id):# This is the view that is called when the user clicks on the execute button, you can override this to# customize the execution of the command, check source for information on how to do this.returnsuper().execute_command_view(request,object_id)defget_queryset(self,request):# This is the queryset that is used to filter the commands that are shown in the admin.# You can override this to customize the queryset for the userreturnsuper().get_queryset(request)admin.site.unregister(ManagementCommands)admin.site.register(ManagementCommands,CustomManagementCommandsAdmin)
Package: django-admin-compare
Django-admin-compareDescriptionadds an actioncompareto the admin panel on a page with a list of objects.Page admin change_listPage admin compareInstalladd 'django_admin_compare' to INSTALLED_APPSUseuse somewhere in admin.py:from django_admin_compare.action import compare

class ArticleAdmin(admin.ModelAdmin):
    list_display = ['title', 'status']
    ordering = ['title']
    actions = [compare]  #add compare in actionOverwrite cssUse css classtabletable-compilefor override style.For example, you can add when you redefine the django template change_list.html.requires: Django>=3.2 ,<4 but it will probably work on other versions as wellLicense MIT
Package: django-admin-contextmenu
django-admin-contextmenuThis is a multi-directional context menu for Django admin. It adds a new column in your admin's changelist page, after the checkbox column. When it is clicked a pop menu opens. The menu is completely empty and it is the best place for including links to other entites.RequirementsDjango > 2.2Python > 3.5InstallationUse your favorite Python package manager to install the app from PyPI, e.g.Example:pip install django-admin-contextmenuAddcontextmenutoINSTALLED_APPS:Example:INSTALLED_APPS=(...'contextmenu',...)Example usage in adminfromcontextmenu.optionsimportCustomModelAdmin@admin.register(ExampleModel)classExampleAdmin(CustomModelAdmin):defget_contextmenu_items(self,obj):return[{'title':'Example link title','url':'http://example.url'},....{'title':'Example link title','url':'http://example.url'},]```## [0.1.0] - 2020-03-05### Added-Initialcommit
Package: django-admin-countless
Django-admin-countlessDjango-Admin-Countless provides a mixin for Django admin to eliminate count
queries.Installationpipinstalldjango-admin-countlessUsageFull example located attestproject.testapp.adminfromdjango.contribimportadminfromcountless_adminimportCountlessAdminMixinfromtest_project.test_app.modelsimportMyModel@admin.register(MyModel)classMyModelAdmin(CountlessAdminMixin,admin.ModelAdmin):pass
Package: django-admin-csv
Adds a “download csv” option to your ModelAdmin. Simply add “admin_csv” to your
INSTALLED_APPS, and have your ModelAdmin extend CSVMixin like so:fromadmin_csvimportCSVMixinclassMyModelAdmin(CSVMixin,admin.ModelAdmin):list_display=['foo','bar','baz']csv_fields=list_display+['qux']
Package: django-admin-csvexport
DescriptionDjango-admin-csvexport is a django-admin-action, that allows you to export the
items of your django-admin changelist as csv-formatted data.Featuresselectable model-fieldsrelated models includedcustomizable csv-formatview or download csv-dataInstallationInstall from pypi.org:pip install django-admin-csvexportAdd csvexport to your installed apps:INSTALLED_APPS = [
    'csvexport',
    ...
]Add csvexport to the actions of your modeladmin:from csvexport.actions import csvexport

class MyModelAdmin(admin.ModelAdmin):
    ...
    actions = [csvexport]ConfigurationThe following settings determine the depth of the model references and the
value to display for empty fields:CSV_EXPORT_REFERENCE_DEPTH = 3
CSV_EXPORT_EMPTY_VALUE = ''The following settings define the csv-format to be used. The default values meet
the unix standard csv-format:CSV_EXPORT_DELIMITER = ','
CSV_EXPORT_ESCAPECHAR = ''
CSV_EXPORT_QUOTECHAR = '"'
CSV_EXPORT_DOUBLEQUOTE = True
CSV_EXPORT_LINETERMINATOR = r'\n'
CSV_EXPORT_QUOTING = 'QUOTE_ALL'For the newline escape sequence use a raw-string.ForCSV_EXPORT_QUOTINGuse the name of one of thesecsvmodule
constants:QUOTE_ALLQUOTE_MINIMALQUOTE_NONNUMERICQUOTE_NONEThe csv-format can also be adjusted by the formular rendered by the csvexport
admin-action. If there is no need to adjust the csv-format on each export use:CSV_EXPORT_FORMAT_FORM = FalseThe formular can also be extended by a checkbox which allows to filter the
resulting csv rows to be unique. Therefore use:CSV_EXPORT_UNIQUE_FORM = TrueWith the following additional parameters for your ModelAdmin you could limit the
fields offered by the export form and choose them to be preselected:class MyModelAdmin(admin.ModelAdmin):
    csvexport_export_fields = [
        'field_a',
        'field_b,
        'relational_field.field_a_on_related_model',
        ...
    ]
    csvexport_selected_fields = [
        'field_a',
        'field_b,
        'relational_field.field_a_on_related_model',
        ...
    ]Fields of related models could be referenced by using a dot between the
relational fields and the fields to be exported:'relation_a.relation_b.any_field'. Not definingcsvexport_export_fieldsmeans all possible fields will be regarded.The CSV_EXPORT_REFERENCE_DEPTH value could also be adjusted in modeladmin specific
manner:class MyModelAdmin(admin.ModelAdmin):
    csvexport_reference_depth = 2UsageJust use it as any django-admin-action: Select your items, choose csvexport
from the admin-action-bar and go. You will be led to a formular that allows
you to view or download your items as csv-data.
Package: django-admin-csvexport2
DescriptionDjango-admin-csvexport is a django-admin-action, that allows you to export the
items of your django-admin changelist as csv-formatted data.Featuresselectable model-fieldsrelated models includedcustomizable csv-formatview or download csv-dataInstallationInstall from pypi.org:pip install django-admin-csvexportAdd csvexport to your installed apps:INSTALLED_APPS = [
    'csvexport',
    ...
]Add csvexport to the actions of your modeladmin:from csvexport.actions import csvexport

class MyModelAdmin(admin.ModelAdmin):
    ...
    actions = [csvexport]ConfigurationThe following settings determine the depth of the model references and the
value to display for empty fields:CSV_EXPORT_REFERENCE_DEPTH = 3
CSV_EXPORT_EMPTY_VALUE = ''The following settings define the csv-format to be used. The default values meet
the unix standard csv-format:CSV_EXPORT_DELIMITER = ','
CSV_EXPORT_ESCAPECHAR = ''
CSV_EXPORT_QUOTECHAR = '"'
CSV_EXPORT_DOUBLEQUOTE = True
CSV_EXPORT_LINETERMINATOR = r'\n'
CSV_EXPORT_QUOTING = 'QUOTE_ALL'For the newline escape sequence use a raw-string.ForCSV_EXPORT_QUOTINGuse the name of one of thesecsvmodule
constants:QUOTE_ALLQUOTE_MINIMALQUOTE_NONNUMERICQUOTE_NONEThe csv-format can also be adjusted by the formular rendered by the csvexport
admin-action. If there is no need to adjust the csv-format on each export use:CSV_EXPORT_FORMAT_FORM = FalseThe formular can also be extended by a checkbox which allows to filter the
resulting csv rows to be unique. Therefore use:CSV_EXPORT_UNIQUE_FORM = TrueWith the following additional parameters for your ModelAdmin you could limit the
fields offered by the export form and choose them to be preselected:class MyModelAdmin(admin.ModelAdmin):
    csvexport_export_fields = [
        'field_a',
        'field_b,
        'relational_field.field_a_on_related_model',
        ...
    ]
    csvexport_selected_fields = [
        'field_a',
        'field_b,
        'relational_field.field_a_on_related_model',
        ...
    ]Fields of related models could be referenced by using a dot between the
relational fields and the fields to be exported:'relation_a.relation_b.any_field'. Not definingcsvexport_export_fieldsmeans all possible fields will be regarded.The CSV_EXPORT_REFERENCE_DEPTH value could also be adjusted in modeladmin specific
manner:class MyModelAdmin(admin.ModelAdmin):
    csvexport_reference_depth = 2UsageJust use it as any django-admin-action: Select your items, choose csvexport
from the admin-action-bar and go. You will be led to a formular that allows
you to view or download your items as csv-data.
Package: django-admin-custom-filters
Custom filters for Django Admin##Information1. Custom choice filter1.1. Filter by multiple choices
(Less and Equal, More and Equal, Equal) in each metrics / dimensions lookups1.2. Add multiple metrics / dimensions for combined queries1.3. You can add any name for your metrics / dimension to label2. Custom dropdown filter2.1. Filter uses default view of django list_filter in condition
when values less than slice count (default slice count is 3)2.2. When values in filter more than slice count view changed
to select element.##InstallYou can install this by usingpip:pipinstalldjango-admin-custom-filters##Usage1. Custom choice filter1.1. Create child class by using parent class CustomInputChoiceFilter.fromdjango_admin_custom_filters.filtersimportCustomInputChoiceFilterclassChildFilter(CustomInputChoiceFilter):1.2. Edit variables - title, parameters_title, parameters_name.fromdjango_admin_custom_filters.filtersimportCustomInputChoiceFilterclassChildFilter(CustomInputChoiceFilter):title="Test Filter"parameters_name=['variable_1','variable_2']parameters_title=['Variable First','Variable Second']1.3. Create child class by using parent class CustomModelAdmin.fromdjango_admin_custom_filters.adminimportCustomModelAdminclassTestAdmin(CustomModelAdmin):1.4. Add to list_filter your filter.fromdjango_admin_custom_filters.adminimportCustomModelAdminfrom.filtersimportChildFilterfrom.modelsimportTestclassTestAdmin(CustomModelAdmin):list_filter=(ChildFilter,)classMeta:model=Test2. Custom dropdown filter2.1. You can create child class for change slice count.fromdjango_admin_custom_filters.filtersimportDropdownFilterclassCustomDropdownFilter(DropdownFilter):slice_count=22.2. Add to list_filter your filter.fromdjango.contribimportadminfrom.filtersimportCustomDropdownFilterfrom.modelsimportTestclassTestAdmin(admin.ModelAdmin):list_filter=(('variable_1',CustomDropdownFilter),)classMeta:model=Test3. Img from examples folder code3.1. Custom choice filter and Custom dropdown filter3.2. Custom dropdown filter by slice more than values in filter.![Image2](img/image 2.png?raw=true)
Package: django-admin-customizer
Django admin customizing interfaceFeaturesMultiple admin instances for the same modelCustomization of:list_displaylist_filterraw_id_fieldssearch_fieldsTODOactions configuratorbase admin class supportRequirementsDjango 1.2, 1.3, 1.4, trunk. Django 1.1 is NOT supported.Python 2.6 or 2.7Installation guideInstall from pypi, with pip:pip install django-admin-customizerOr with setuptools:easy_install django-admin-customizerAddadmin_customizertoINSTALLED_APPS:INSTALLED_APPS += ("admin_customizer", )Add the admin customizer’s urls to your root url conf. This is the url where
your will access your custom admin instances. Eg: in your project’s urls.py add:(r'^admin/_/', include('admin_customizer.urls')),After that you need to run:manage.py syncdbOr if you use south:manage.py syncdb --migrateYou need to updateadmin_customizer’s models to get it working, initially and
after each model change with:manage.py refresh_available_fieldsNote:If you delete models the registered admins will be deleted for them.If you delete fields from models the registered admins will have them
removed after you run refresh_available_fields.django-admin-customizerhas static files for widgets in the edit interface.
If you use staticfiles just run:manage.py collectstaticIf you do not use django.contrib.staticfiles you must manually symlink the
site-packages/admin_customizer/static/admin_customizer dir to <your media root>/admin_customizer.Making extra actions availableTODOSettingsADMIN_CUSTOMIZER_MAX_FIELD_DEPTH- depth to look for relations when
inspecting models.MiddlewareTo enable urlpattern reloading add'admin_customizer.middleware.URLResolverReloadMiddleware'toMIDDLEWARE_CLASSES.Warning!You must have working django cache for this to work properly ! See django’scache documentationon this.If you do not enable this you will have to restart the webserver after every
AdminSite or RegisteredModel change !ScreenshotsEdit page:
Package: django-admin-data-from-external-service
django-admin-data-from-external-serviceHelpers to extend Django Admin with data from external service with minimal hacksLive demowithsourcesonHerokufree quota (please be patient, it will take some time for the app to wake up)viewGithub repository of Django org (sources), may appear api rate limit errorviewrecipes from ClickHouseplayground(sources)Main features:reuse Django Admin layout to simplify customization of viewing and managing external data (list/view/filter+search/ordering)datasource agnosticdjango2.x/django3.x/django4.x supportHow it worksUsed custom ChangeList to determine method to pull external data and mock paginator behaviour.Examplefromdjango.dbimportmodelsfromdjango.contribimportadminfromdadfes.adminimportDfesAdminModelMixin# Declare model for external data (managed: false)classExternalUser(models.Model):id=models.IntegerField("Id",primary_key=True)username=models.TextField("Username")classMeta:managed=Falseverbose_name="External User Model"# 1. mixin DfesAdminModelMixinclassExternalUserAdmin(DfesAdminModelMixin,admin.ModelAdmin):list_display=("id","username",)# 2. and implement get_list method with returning# `{"total": <total number or items>, "items": <list of ExternalUser instances>}`defget_list(self,request,page_num,list_per_page):# 2.1 pull data from some service, where#   search = request.GET.get('q')#   order_by = request.GET.get('o')#   some_list_filter = request.GET.get('some_list_filter')data={'total':1,'users':[{'id':1,'username':'User1'},]}# 2.2 map data to model instancesitems=[ExternalUser(**i)foriindata.get("users")or[]]return{"total":data.get("total")or0,"items":items,}# 3. other standart django admin customizationdefget_object(self,request,object_id,*args,**kwargs):# 3.1 fetch object from external serviceuser={'id':1,'username':'User1'},# 3.2 map data to model instancereturnExternalUser(**user)admin.site.register(ExternalUser,ExternalUserAdmin)LicenseThis project is licensed underMIT license (LICENSEorhttp://opensource.org/licenses/MIT)
Package: django-admin-data-views
Django Admin Data Viewspipinstalldjango-admin-data-viewsDocumentation:https://mrthearman.github.io/django-admin-data-views/Source Code:https://github.com/MrThearMan/django-admin-data-views/Django Admin Data Views enables you to easily add non-model data to the django admin panel.
Data from an API or file can be shown in similar table and item views than regular models.
Package: django-admin-daterange-filter
django-admin-daterange-filter/README.rst=====admin_daterange_filter=====DateRangeFilter in django adminDetailed documentation is in the "docs" directory.Quick start-----------1. Add "admin_daterange_filter" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'admin_daterange_filter',)2. use DateRangeFilter in list_filter::class YourAdmin(admin.ModelAdmin):list_filter=(('yourdate',DateRangeFilter),)3. note:jquery-core use django.jquery, so I only modify the js file for Chinese Language, you can modify yourself for other's language
Package: django-admin-decorators
Django’s admin accepts callables for list_display and readonly_fields.
In order to customize these callables (e.g. annotate them with a description)
django requires developer to set an attribute on a callable
(e.g. ‘short_description’). This is a simple approach and it works.But it is easy to make a typo or to forget what attribute should be set
on a callable because there is no autocompletion.This app provides an alternative (decorator) syntax for that + a couple
of other decorators useful for customizing django admin.Installationpip install django-admin-decoratorsUsagefrom django.contrib import admin
from admin_decorators import (short_description, limit_width, boolean,
                               apply_filter, order_field, allow_tags)
from myapp.models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    list_display = 'name', '_text', 'has_huge_text', 'html_url'
    readonly_fields = ['name', 'html_url']

    @short_description('The text limited to 100 chars')
    @order_field('text')
    @limit_width(100)
    def _text(self, obj):
        return obj.text

    @boolean
    @short_description('The text is huge')
    def has_huge_text(self, obj):
        return len(obj.text) > 100

    @short_description('link')
    @order_field('url')
    @allow_tags
    @apply_filter('urlize')
    def html_url(self, obj):
        return obj.url

admin.site.register(MyModel, MyModelAdmin)Note thatallow_tagsdecorator marks result as safe so it will be html both
in list_display and readonly_fields.Take a look at source code for more decorators.DevelopmentDevelopment happens atbitbucketandgithub.If you’ve found a bug or have an idea for a new decorator feel free to open
a ticket and/or send a pull request.
Package: django-admin-dialog
Shows a dialog popup with helptext for the admin fields that you have indicated.Requirementsdjango-redactoreditorInstallationInstall the app via pip:$pipinstalldjango-admin-dialogAdddjango_admin_dialogandredactorto your installated apps:INSTALLED_APPS=(...'redactor','django_admin_dialog',...Add the context processor to yourTEMPLATE_CONTEXT_PROCESSORS:TEMPLATE_CONTEXT_PROCESSORS=(...'django_admin_dialog.context_processors.django_admin_dialog',)Override the admin base template (base.html) and include this:{% include "django_admin_dialog/django_admin_dialog.html" %}In your admin.py file, add this mixin for all your ModelAdmin’s that you want to add the dialog:fromdjango_admin_dialog.mixinsimportDjangoAdminDialogMixinclassMyModelAdmin(DjangoAdminDialogMixin,admin.ModelAdmin):...And run the migrations:$manage.pymigratedjango_admin_dialogUsageAccess to the DjangoAdminDialog application.In this form you indicate the url on which you want to show the modal dialog boxes and the field id.If you want to know the name of the form fields, you can set this setting variable:DJANGO_ADMIN_DIALOG_SHOW_IDS=TrueNow if you access to your model form, you can see the field id’s next to them.When you access to your model admin form, you can see a new icon next to the field that you indicate previously.And now you can click on this icon to show the dialog.
Package: django-admin-display-fields-settings
Django application. It adds a column view control form into admin area. You can choose which fields to display and sort them in the correct order for you. Possible fields for display are taken fromlist_display. To sort the fields just drag the field into place.Quick startDownload it from PyPi withpip installdjango-admin-display-fields-settingsAdd “admin_display_fields_settings” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'admin_display_fields_settings',
)Include the admin_display_fields_settings URLconf in your project urls.py like this:url(r'^admin_display_fields_settings/', include('admin_display_fields_settings.urls'))Runpython manage.py syncdborpython manage.py migrateto create the admin_display_fields_settings models.In your admin.py:from django.contrib import admin
from polls.models import MyModel
from admin_display_fields_settings.admin import DisplayFieldsSettingsAdmin


class MyModelAdmin(DisplayFieldsSettingsAdmin):

    list_display = ('question', 'pub_date', 'was_published_recently', 'full_name', '__str__', '__unicode__')

admin.site.register(MyModel, MyModelAdmin)Example