Saravanan666/pypi-org huggingface dataset:
Package: django-admin-notice
Django Admin NoticeShow a floating notice banner above the Django admin interface.
Particularly useful for indicating the current deployment environment.InstallationInstall django-admin-notice by runningpip install django-admin-noticeAddadmin_noticeto yourINSTALLED_APPSsomewhere beforedjango.contrib.admin.INSTALLED_APPS=["admin_notice",# <-- Add this somewhere before "django.contrib.admin""django.contrib.admin",# ... other apps]Addadmin_notice.context_processors.noticeto the templatescontext_processors.
Havingdjango.template.context_processors.requestis required as well.TEMPLATES=[{"OPTIONS":{"context_processors":["django.template.context_processors.request",# <-- have this"admin_notice.context_processors.notice",# <-- Add this# ... other context processors]},},]SettingsSet theADMIN_NOTICE_TEXTto the text you want to show above the admin interface.
No message is shown if this setting is missing or empty.ADMIN_NOTICE_TEXT="Production environment"Optionally specify a custom text color and background for your notice.
The default text color iswhiteand the default backgroundred.ADMIN_NOTICE_TEXT_COLOR="white"ADMIN_NOTICE_BACKGROUND="red"Furthermore, optional dark theme color variants can be specified.
The dark theme colors default to the non-dark theme colors.ADMIN_NOTICE_TEXT_COLOR_DARK="#f2f2f2"ADMIN_NOTICE_BACKGROUND_DARK="#FA8072"TipsIt's a common use case to indicate the projects deployment environment.
The following configuration shows how to obtain thedjango-admin-noticeconfiguration from environment variables and how to configure a fallback.fromosimportenvironADMIN_NOTICE_TEXT=environ.get("ADMIN_NOTICE_TEXT","Local environment")ADMIN_NOTICE_TEXT_COLOR=environ.get("ADMIN_NOTICE_TEXT_COLOR","white")ADMIN_NOTICE_BACKGROUND=environ.get("ADMIN_NOTICE_BACKGROUND","green")Example projectTake a look at our Django example project undertests/project. You can run it by executing these commands:poetry installpoetry run python tests/project/manage.py migratepoetry run python tests/project/manage.py createsuperuserpoetry run python tests/project/manage.py runserver
Package: django-admin-notification
django-admin-notificationdjango-admin-notification is a Django app to display notification in Django admin panel.InstallationRunpip install django-admin-notificationAddadmin_notificationtosettings.INSTALLED_APPSbeforedjango.contrib.adminINSTALLED_APPS=(#..."admin_notification",#..."django.contrib.admin",#...)In settings.py:NOTIFICATION_MODEL='myapp.MyModel'# Select the model you want to control, for example: "accounts.Message"If you have changed the base url of the admin site. in settings.py:ADMIN_SITE_BASE_URL='admin_site_base_url/'# default is "admin/In urls.py:...fromadmin_notification.viewsimportcheck_notification_viewurlpatterns=[path('check/notification',check_notification_view,name="check_notifications"),...]Runpython manage.py migrateRestart your application serverVisithttp://127.0.0.1:8000/admin/Create an instance of the model(NOTIFICATION_MODEL) and enjoy :)
Package: django-admin-notifications
A simple app to allow apps to register notifications that can be displayed in the admin via a template tagInstallationAdd ‘admin_notifications’ to INSTALLED_APPSBasic usageCustomize whichever of your admin templates you which to display the notifications thus.load the template tags at the start of the template:{% load notification_tag %}add the tag to your template. I customised the admin index template and placed the tag before the ‘content-main’ DIV like thus:{% block content %}
<!-- here's the tag you add -->
{% error_notifications %}
<div id=''content-main">in urls.py:import admin_notifications
admin_notifications.autodiscover()This looks in each app for a file called ‘notifications.py and registers it if it exists.Notifications files can contain as many functions as you like. Each one should return a string which can contain HTML and each one needs to be registered using admin_notifications.registerIf you return an empty string then no notification is shown.Notifications functions are called every time the admin template is rendered so avoid doing heavy calculations in the notification.An example notifications.py might look like this:import admin_notifications
from models import Url
def notification():
    broken_links = Url.objects.filter(status=False).count()
    if broken_links:
        return "You have %s broken link%s.<br>You can view or fix them using the <a href='/admin/linkcheck/'>Link Manager</a>." % (broken_links, "s" if broken_links>1 else "")
    else:
        return ''

admin_notifications.register(notification)
Package: django-admin-numeric-filter
django-admin-numeric-filterdjango-admin-numeric-filter provides you several filter classes for Django admin which you can use to filter results in change list. It works inlist_filterwhen a field name is defined as list where the first value is field name and second one is custom filter class (you can find classes below).Don't forget to inherit your model admin fromadmin_actions.admin.NumericFilterModelAdminto load custom CSS styles and JavaScript files declared in inner Media class.Getting startedInstallationpipinstalldjango-admin-numeric-filterAddadmin_numeric_filterintoINSTALLED_APPSin your settings file beforedjango.contrib.admin.Sample admin configurationfromadmin_numeric_filter.adminimportNumericFilterModelAdmin,SingleNumericFilter,RangeNumericFilter,\SliderNumericFilterfrom.modelsimportYourModelclassCustomSliderNumericFilter(SliderNumericFilter):MAX_DECIMALS=2STEP=10@admin.register(YourModel)classYourModelAdmin(NumericFilterModelAdmin):list_filter=(('field_A',SingleNumericFilter),# Single field search, __gte lookup('field_B',RangeNumericFilter),# Range search, __gte and __lte lookup('field_C',SliderNumericFilter),# Same as range above but with slider('field_D',CustomSliderNumericFilter),# Filter with custom attributes)Filter classesClass nameDescriptionadmin_actions.admin.SingleNumericFilterSingle field search, __gte lookupadmin_actions.admin.RangeNumericFilterRange search, __gte and __lte lookupadmin_actions.admin.SliderNumericFilterSame as range above but with sliderSlider default options for certain field typesDjango model fieldStepDecimal placesdjango.db.models.fields.DecimalField()Based on decimal placesmax precision from DBdjango.db.models.fields.FloatField()Based on decimal placesfield decimal_places attrdjango.db.models.fields.IntegerField()10
Package: django-admin-oauth-sessions
Django Admin Oauth SessionsA django Project for custom authentication for sso tokensFree software: BSD licenseDocumentation:https://django-admin-oauth-sessions.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.django_admin_oauth_sessions is a Django app to validate SSO tokens.Quick startAdd “django_admin_auth_keycloak” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'django_admin_oauth_sessions',
]Add “DjangoAdminOAuthSessionMiddleware” in your MIDDLEWARE in settings file:MIDDLEWARE = [
    ...
    'django_admin_oauth_sessions.django_admin_oauth_sessions.DjangoAdminOAuthSessionMiddleware',
]Update the logout url in urls.py as:path('admin/logout/', logout_view, name='logout')
import logout_view from django_admin_oauth_sessions
e.g from django_admin_oauth_sessions.views import logout_viewStart the development server:visit http://localhost:8000/admin/
to create a django_admin_oauth_sessions (you'll need the Admin app enabled).History0.1.0 (2022-03-02)First release on PyPI.
Package: django_admin_ordering
Please refer to the CI build linked above for the currently supported
combinations of Python and Django.Installationpip installdjango-admin-ordering, and addadmin_orderingtoINSTALLED_APPS.UsageFirst, you need a model ordered by an integer field. If you are happy
with a model where 1. the ordering field is calledorderingand 2.
the ordering field is automatically initialized so that new objects are
ordered last you can also inherit the abstractadmin_ordering.models.OrderableModelmodel. If you define your ownclass Metayou should inheritOrderableModel.Metaso that theorderingattribute is set to the correct value:fromadmin_ordering.modelsimportOrderableModelclassMyModel(OrderableModel):# ...classMeta(OrderableModel):# ...Orderable change listsfromadmin_ordering.adminimportOrderableAdmin@admin.register(MyModel)classMyModelAdmin(OrderableAdmin,admin.ModelAdmin):# The field used for ordering. Prepend a minus for reverse# ordering: "-order"ordering_field="order"# You may optionally hide the ordering field in the changelist:# ordering_field_hide_input = False# The ordering field must be included both in list_display and# list_editable:list_display=["name","order"]list_editable=["order"]Orderable inlinesfromadmin_ordering.adminimportOrderableAdminclassMyModelTabularInline(OrderableAdmin,admin.TabularInline):model=MyModel# Same as above; "-order" is also allowed here:ordering_field="order"# ordering_field_hide_input = FalseOrderableAdmincomes with a default ofextra = 0(no extra
empty inlines shown by default). It is strongly recommended to leave the
changed default as-is, because otherwise you’ll end up with invalid
inlines just because you wanted to change the ordering.LimitationsStarting with Django 1.9 newly created inlines are automatically
assigned a good ordering value. Earlier versions do not support the
requiredformset:addedsignal.OrderableAdmincan be used both for inlines and parents, but this
also means that you cannot register a model directly withOrderableAdmin.Using django-admin-ordering with filtered or paginated lists may
produce unexpected results. The recommendation right now is to setlist_per_pageto a bigger value and not reordering filtered
changelists.Note that django-admin-ordering assigns ordering values in increments
of 10, emphasizing that the ordering value should not have any
significance apart from giving relative ordering to elements.
Package: django-adminpanel
django-adminpanelBSD-licensed menu tools for Django, built by Devdjango-adminpanel provides a basic structure for you to build multiple navigation menus, pages creation , basic settings as well as widgets creation facility for your website, such as the admin panel. These admin panel can be easily  maintained by administration without any knowledge
of HTML or Django internals.admin panel can also be easily built pages and displayed only for particular URIs.Installation & Configuration:pip install django-adminpanelAddadminpanelto yourINSTALLED_APPS./manage.py migrate adminpanel(or./manage.py syncdbif you don't use South. You should use South.)AddMEDIA_ROOT and MEDIA_URLin your settings.py fileAddSTATICFILES_DIRSin your settings.py fileAddtemplates pathin your settings.py file intotemplates -> DIRSAddsite_urlin your settings.py file as aSITE_URL=%%AddADMIN_SITEor admin panel name in your settings.py file as aADMIN_SITE=%%
Package: django-admin-panel-arnika
django-admin-panel-arnika est un modèle pour Django ManagerThis admin panel has been edited by jazzmin and works only for the right languagesQuick startAdd to terminal:pipinstalldjango-admin-panel-arnikaAdd jazzmin to the first list before admin app:INSTALLED_APPS=['jazzmin',]change in settings.py:LANGUAGE_CODE='fa-ir'add to urls.py:fromdjango.urlsimportincludefromjazzmin.viewimportregisterurlpatterns=[path("i18n/",include("django.conf.urls.i18n")),path("",include("django.contrib.auth.urls")),path('register',register,name='register'),]]5.run to server
Package: django-admin-permissions
django-admin-permissionsVery simple extension that adds a permissions check on the field in adminRequirementsPython 2.7+ or Python 3.3+Django 1.8+InstallationUse your favorite Python package manager to install the app from PyPI, e.g.Example:pip installdjango-admin-permissionsAddadmin_permissionstoINSTALLED_APPS:Example:INSTALLED_APPS=(...'admin_permissions',...)Example usageUse classFieldPermissionMixinand set permissions usingfields_permissions:fromdjango.contribimportadminfromadmin_permissions.adminimportFieldPermissionMixinclassArticleAdmin(FieldPermissionMixin,admin.ModelAdmin):fieldsets=[('General',{'fields':['title','slug','text'],}),('SEO',{'fields':['seo_title','seo_description'],}),]fields_permissions={# 'permission': ('field',)'articles.can_change_admin_seo_fields':('seo_title','seo_description'),}# in articles/models.py:classArticle(models.Model):classMeta:permissions=(('can_change_admin_seo_fields',_('Show SEO fields')),)Then run makemigrations to add all the permissions in your databaseOptionsIf you want the user to see the field, but could not edit them, setfields_permissions_read_onlyisTrue, defaultFalse.
Package: django-admin-persian-fonts
django-admin-persian-fontsdjango-admin-persian-fonts is a Django app for fast and easy use of Persian fonts in the Django admin panel.InstallationRunpip install django-admin-persian-fontsAddadmin_persiantosettings.INSTALLED_APPSbeforedjango.contrib.adminINSTALLED_APPS=(#..."admin_persian",#..."django.contrib.admin",#...)Runpython manage.py migrateRestart your application serverVisithttp://127.0.0.1:8000/admin/
Package: django-adminplus
AdminPlusaims to be the smallest possible extension to the excellent
Django admin component that lets you add admin views that are not tied to
models.There are packages out there, likeNexusanddjango-admin-toolsthat
replace the entire admin. Nexus supports adding completely new “modules” (the
Django model admin is a default module) but there seems to be a lot of boiler
plate code to do it. django-admin-tools does not, as far as I can tell, support
adding custom pages.All AdminPlus does is allow you to add simple custom views (well, they can be
as complex as you like!) without mucking about with hijacking URLs, and
providing links to them right in the admin index.Installing AdminPlusInstall fromPyPIwith pip:pipinstalldjango-adminplusOr get AdminPlus fromGitHubwith pip:pipinstall-egit://github.com/jsocol/django-adminplus#egg=django-adminplusAnd addadminplusto your installed apps, and replacedjango.contrib.adminwithdjango.contrib.admin.apps.SimpleAdminConfig:INSTALLED_APPS=('django.contrib.admin.apps.SimpleAdminConfig',# ...'adminplus',# ...)To use AdminPlus in your Django project, you’ll need to replacedjango.contrib.admin.site, which is an instance ofdjango.contrib.admin.sites.AdminSite. I recommend doing this inurls.pyright before callingadmin.autodiscover():# urls.pyfromdjango.contribimportadminfromadminplus.sitesimportAdminSitePlusadmin.site=AdminSitePlus()admin.autodiscover()urlpatterns=[# ...# Include the admin URL conf as normal.(r'^admin',include(admin.site.urls)),# ...]Congratulations! You’re now using AdminPlus.Using AdminPlusSo now that you’ve installed AdminPlus, you’ll want to use it. AdminPlus is
100% compatible with the built in admin module, so if you’ve been using that,
you shouldn’t have to change anything.AdminPlus offers a new function,admin.site.register_view, to attach arbitrary views to the admin:# someapp/admin.py# Assuming you've replaced django.contrib.admin.site as above.fromdjango.contribimportadmindefmy_view(request,*args,**kwargs):passadmin.site.register_view('somepath',view=my_view)# And of course, this still works:fromsomeapp.modelsimportMyModeladmin.site.register(MyModel)Nowmy_viewwill be accessible atadmin/somepathand there will be a
link to it in theCustom Viewssection of the admin index.You can also useregister_viewas a decorator:@admin.site.register_view('somepath')defmy_view(request):passregister_viewtakes some optional arguments:name: a friendly name for display in the list of custom views. For example:defmy_view(request):"""Does something fancy!"""admin.site.register_view('somepath','My Fancy Admin View!',view=my_view)urlname: give a name to the urlpattern so it can be called byredirect(),reverse(), etc. The view will be added
to theadminnamespace, so a urlname offoowould be reversed
withreverse("admin:foo").visible: a boolean or a callable returning one, that defines if
the custom view is visible in the admin dashboard.All registered views are wrapped inadmin.site.admin_view.NoteViews with URLs that match auto-discovered URLs (e.g. those created via
ModelAdmins) will override the auto-discovered URL.
Package: django-admin-plus
Welcome to Django Admin Plus!Django Admin Plus is Django Admin Panel extension application.RequirementsPython 3.7+ onlyDjango 3.0+ onlyNo external packages requiredInstallationpipinstalldjango-admin-plusUsage instructionsDocumentationCheck out thedocumentationfor
more info.LicenseMIT LicenseSeeLICENSEto see
the full text.
Package: django-admin-rangefilter
django-admin-rangefilterA Django app that adds a filter by date range and numeric range to the admin UI.RequirementsPython 3.6+Django 1.11+InstallationUse your favorite Python package manager to install the app from PyPI, e.g.Example:pip installdjango-admin-rangefilterAddrangefiltertoINSTALLED_APPS:Example:INSTALLED_APPS=(...'rangefilter',...)Example usageIn adminfromdatetimeimportdatetimefromdjango.contribimportadminfromrangefilter.filtersimport(DateRangeFilterBuilder,DateTimeRangeFilterBuilder,NumericRangeFilterBuilder,DateRangeQuickSelectListFilterBuilder,)from.modelsimportPost@admin.register(Post)classPostAdmin(admin.ModelAdmin):list_filter=(("created_at",DateRangeFilterBuilder()),("updated_at",DateTimeRangeFilterBuilder(title="Custom title",default_start=datetime(2020,1,1),default_end=datetime(2030,1,1),),),("num_value",NumericRangeFilterBuilder()),("created_at",DateRangeQuickSelectListFilterBuilder()),# Range + QuickSelect Filter)Support Content-Security-PolicyFor Django 1.8+, ifdjango-cspis installed, nonces will be added to style and script tags.
Package: django-admin-rangefilter-jalali
django-admin-rangefilter-jalali# Note django 1.8 not working pls w8 to fix itdjango-admin-rangefilter-jalali app, add the filter by a custom jdate / jdatetime range on the admin UI.RequirementsPython 2.7+ or Python 3.4+Django 1.8+InstallationUse your favorite Python package manager to install the app from PyPI, e.g.Example:pip installdjango-admin-rangefilter-jalaliAddrangefilter_jalalitoINSTALLED_APPS:Example:INSTALLED_APPS=(...'django_jalali','rangefilter_jalali',...)Example usageIn adminfromdjango.contribimportadminfromrangefilter_jalali.filterimportDateRangeFilter,DateTimeRangeFilterfrom.modelsimportPost@admin.register(Post)classPostAdmin(admin.ModelAdmin):list_filter=(('created_at',DateRangeFilter),('updated_at',DateTimeRangeFilter),)
Package: django-admin-related
Django Admin Relatedthis project makes it impossible for the user to delete objects that contain other objects related by django admin.Obs: this project works only in django adminInstall:pip install django-admin-relatedUsage:Add to your INSTALLED_APPS, in settings.py:INSTALLED_APPS = [  
    ...
    'django_admin_related',
    ...
]Create admin for your model:from django.contrib.admin import register
from django_admin_related.admin import VerifyRelated

@register(YouModel)
class YouModelAdmin(VerifyRelated):
    """
        from best performance use `verify_related_fields`
        because this check all fields is a point to other model
        and `verify_related_fields` is a direct way.
    """
    passTest:try this: create a simple model, and simple related model, and exclude a first model.Advanced:if you need to specify relationships, you can do so :from django.contrib.admin import register
from django_admin_related.admin import VerifyRelated

@register(YouModel)
class YouModelAdmin(VerifyRelated):
    """
        from best performance use `verify_related_fields`
        because this check all fields is a point to other model
        and `verify_related_fields` is a direct way.
    """
    verify_related_fields = ('field', 'field2', ...)
Package: django-admin-reset
This package provides views, to use the built-in Django password reset
functionality from inside the admin interface.Features:Add a link to the top of the user change form, that leads to a new page,
containing the link for the password reset.Remove the features to manually change the users’ passwords from the admin
interface (but see note below).Remove the change password link from the user forms.Remove the password inputs from the user add form.NoteIt’s still possible, to manually change the users’ passwords by going to
the/admin/auth/user/<uid>/password/page. Only the links,
pointing to this page are removed.InstallationThe django-admin-reset package can be installed with pip:pip install django-admin-resetUsageTo use this package, add it toINSTALLED_APPS,
in thesettings.pyfile:INSTALLED_APPS = [
    ...
    'django_admin_reset',
    ...
]Validation timeThe password reset links/tokens, generated by this package, are using the built-in
Django password reset functionality, and so respect thePASSWORD_RESET_TIMEOUTsetting.CompatibilityThis package changes the default user admin class, so it may be incompatible
with other packages, that are also changing it.Compatible Django and Python versions:Django versionPython versions3.2 LTS3.8, 3.9, 3.104.13.8, 3.9, 3.10, 3.114.23.8, 3.9, 3.10, 3.11
Package: django-adminrestrict-CDSP
# Restrict admin django cmsdjango-adminrestrict-CDSP enables you to block access for django 1.8 or more (work with django CMS) unless requests come from specific IP addresses.#Installationpip install django-adminrestrict-CDSP#ConfigurationAdd the apps tosettings.py:INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    ...
    'restrictadmindjango',
    ...
)Next, install theFailedLoginMiddlewaremiddleware:MIDDLEWARE_CLASSES = (
    'restrict_admin_django_cms.middleware.RestrictAdminDjangoCMSMiddleware'
)Add in your settings.py :If you are using Django CMS, you can useCMS_INTERNAL_IPS = […]If you are using only Django, you have to useALLOWED_ADMIN_IPS  = […]
Package: django-admin-resumable2
django-admin-resumable2django-admin-resumable2 is a django app to allow you to upload large files from within the django admin site.ScreenshotInstallation* pip install django-admin-resumable2
* Add ``admin_resumable2`` to your ``INSTALLED_APPS``
* Add ``path('', include('admin_resumable2.urls')),`` to your urls.py
* Add a model field eg: ``from admin_resumable2.fields import ModelAdminResumableFileField``::class Foo(models.Model):
    title = models.CharField(max_length=200)
    file = ModelAdminResumableFileField(upload_to='foo/')

    # use below code to change path of resumable
    def save(self, force_insert=None, force_update=None, using=None, update_fields=None):
        old_path = self.file.path  # Get the current old path
        file_name = os.path.basename(old_path) # get file name

        upload_to_method = Foo._meta.get_field('file').orig_upload_to # Get the original upload to path
        if type(upload_to_method) == str:
            orig_upload_to = upload_to_method + file_name

        else:
            orig_upload_to = upload_to_method(self, file_name)

        new_path = os.path.join(settings.MEDIA_ROOT, orig_upload_to)  # Create the original path

        directory = os.path.dirname(new_path)
        os.makedirs(directory, exist_ok=True)

        if new_path != old_path:
            
            while True:
                file_name, file_extension = os.path.splitext(new_path)
                random_value = ''.join(random.choices(string.ascii_lowercase + string.digits, k=7))
                new_path = file_name + '_' + random_value + file_extension          

                if not os.path.exists(new_path):
                    orig_upload_to = new_path.replace(str(settings.MEDIA_ROOT), '')
                    break              

            shutil.move(old_path, new_path)
            self.file.name = orig_upload_to

        return super().save(force_insert, force_update, using, update_fields)Optionally:* Set ``ADMIN_RESUMABLE_SUBDIR``, default is ``'admin_uploaded'``
* Set ``ADMIN_RESUMABLE_CHUNKSIZE``, default is ``"1*1024*1024*5"``
* Set ``ADMIN_RESUMABLE_STORAGE``, default is ``'django.core.files.storage.FileSystemStorage'``Compatibility{py37, py38, py310}-django{4.* above}