Saravanan666/pypi-org huggingface dataset:
Package: django-non-dark-admin
Disable or enable dark mode user interface in Django admin panel (Django==3.2).InstallationFor install this app run in terminal:pip install django-non-dark-adminConfiguration for all usersAdd ‘’django_non_dark_admin’’ to yourINSTALLED_APPSsettings. This is must be addedBEFORE‘’django.contrib.admin’’.Set ‘’DISABLE_DARK_MODE = True’’ in your settings module to disable dark mode in admin panel user interface to all users.Configuration per userTo have the theme configured as a user preference you will need to have a custom user model (model configured insettings.AUTH_USER_MODEL) as described in Django documentation:https://docs.djangoproject.com/en/4.0/topics/auth/customizing/#substituting-a-custom-user-modelhttps://docs.djangoproject.com/en/4.0/ref/settings/#auth-user-modelAdd a boolean fielddisable_dark_modeto your custom user model:disable_dark_mode=models.BooleanField(verbose_name="Django Admin Theme",default=Falsechoices=((False,"Dark"),(True,"Light")),null=True)After adding the field, run:python manage.py makemigrationsIt should generate a migration like this:# Generated by Django 3.2.9 on 2021-12-27 19:17fromdjango.dbimportmigrations,modelsclassMigration(migrations.Migration):dependencies=[("app_for_the_auth_custom_model","0XXX_previous_migration"),]operations=[migrations.AddField(model_name="<Your Custom Auth User model>",name="disable_dark_mode",field=models.BooleanField(choices=[(False,"Dark"),(True,"Light")],default=False,null=True,),),]Run the migration:python manage.py migrateAnd the field will be added to yourAUTH_USER_MODEL.Go to the Django admin for your custom user model and add the field to be editable.LicenseLicensed under BSD license. Seelicense linkin documentation.
Package: django-nonefield
django-nonefieldis a None field for Django.A typical use case: allow presentational (non-input, non-field) form
elements (text, image, embed video, etc). This could be very useful if your
forms are dynamic (as in form-builders/generators). Django REST Framework
integration is implemented as well.PrerequisitesDjango 1.8, 1.11, 2.0, 2.1, 2.2, 3.0.Python 2.7, 3.5, 3.6, 3.7, 3.8InstallationInstall latest stable version from PyPI:pipinstalldjango-nonefieldOr latest stable version from GitHub:pipinstallhttps://github.com/barseghyanartur/django-nonefield/archive/stable.tar.gzOr latest stable version from BitBucket:pipinstallhttps://bitbucket.org/barseghyanartur/django-fobi/get/stable.tar.gzAddnonefieldtoINSTALLED_APPSof the your projects’ Django
settings.INSTALLED_APPS=(# ...# None field'nonefield',# ...)Usageforms.pyIn forms you could use it as follows:fromdjangoimportformsfromnonefield.fieldsimportNoneFieldclassMyForm(forms.Form):name=forms.CharField(max_length=255)some_text=NoneField(initial='Lorem ipsum')Seethis snippetas an example of how to allow to use paragraphs in thedjango-forms-builder.serializers.pyYou can also use it in Django REST Framework.fromrest_frameworkimportserializersfromnonefield.contrib.drf_integration.fieldsimportNoneFieldclassContentTextField(NoneField):"""Content text field."""classBarSerializer(serializers.Serializer):title=serializers.CharField(max_length=256)text=serializers.CharField()context_text=ContentTextField(label='',default='Haha')Seehow it’s used in django-fobito allow to use content/presentational elements (text, image, embed video, etc.)
in the Django REST Framework schema.Examplesdjango-forms-builder exampledjango-fobi form elements exampledjango-fobi DRF integration exampleLicenseGPL-2.0-only OR LGPL-2.1-or-laterSupportFor any issues contact me at the e-mail given in theAuthorsection.AuthorArtur Barseghyan <artur.barseghyan@gmail.com>
Package: django-nonmodel-admin
Django NonModel AdminAllows to add sections to django admin which are not tied to any model. They can render some template for example.UsageIn admins.py:from django_nonmodel_admin import NonModelAdmin, register

@register()
class DashboardAdmin(NonModelAdmin):
    name = 'dashboard'
    verbose_name = 'My dashboard'
    change_list_template = "my_app/dashboard.html"register decorator can be used with regular ModelAdmin’s too.Template example:{% extends "admin/change_list.html" %}
{% block content %}
<div id="content-main">
,,, your stuff
</div>
{% endblock %}Extra context can be defined via overwriting get_extra_context method of NonModelAdmin.It can be extended like regular ModelAdmin, for example you can define own get_urls method.You DON’T have to add anything to INSTALLED_APPS.Free software: MIT licenseHistory0.1.0 (2021-09-07)First release on PyPI.
Package: django-nonrelated-inlines
django-nonrelated-inlinesDjango admin inlines for unrelated modelsGetting startedThis app allows you to create admin inlines for models that don't have an
explicit foreign key relationship.To use, subclass your inline from eitherNonrelatedStackedInlineorNonrelatedTabularInlineand addget_form_querysetandsave_new_instancemethods.get_form_queryset(self, obj)returns all objects that should be shown in
the inline formset.save_new_instance(self, parent, instance)given a parent object and a new
child object instance should associate the child object with the parent.For example, let's assume we haveCustomerandInvoicemodels.Invoiceobjects are associated with aCustomerif they share the same email address.fromnonrelated_inlines.adminimportNonrelatedStackedInlineclassCustomerInvoiceStackedInline(NonrelatedStackedInline):model=Invoicefields=['id','amount']defget_form_queryset(self,obj):returnself.model.objects.filter(email=obj.email)defsave_new_instance(self,parent,instance):instance.email=parent.emailWhen viewing anCustomerinstance, we fetch a queryset of allInvoiceinstances sharing the same email address. Similarly, when saving a newInvoiceinstance we make sure to set its email attribute to the same value as its parentCustomer.
Package: django-nose2
A test runner for django 1.2 or better that runs tests with nose2.UsageIn your settings module, set:TEST_RUNNER=djnose2.TestRunnerThenmanage.py testwill run nose2’s test runner.NotesPut command-line arguments for the test runner after ‘–’. For
example, to turn on output buffering:manage.py test -v 2 -- -B(But really, almost all of the time, you’ll want to put your nose2
configuration in a config file).
Package: django_nosql
Django NoSQLStream model changes to an upstream NoSQL databaseSupported backends:FireStoreMockTodo backendsRethinkDBPostgres (JSONField)RESTRedisetcdInstallationpip install django-nosqlSetupAdd to installed apps:INSTALLED_APPS=[...,'django_nosql',...]Configure NoSQL backends:In settings.py:# you can have multiple backends:NOSQL_BACKENDS=['firestore']#  FireStore settingsFIRESTORE_CREDENTIALS_FILE='/path/to/credentials.json'Mark up your models:Inmodels.pyTodo(models.model):# the nosql collection you'd like to usecollection='todos'# A Django Rest Framework serializer for serializing your instanceserializer_path='example_app.models.TodoSerializer'# inform django_nosql that you'd like to sync this modelreadonly_sync=TrueAdd signals:fromdjango_nosql.signalsimport(sync_readonly_db,sync_remove_readonly_db)Test it out:There is an example app included in this repo.To see the sync in action try.python manage.py shellordocker-compose run --rm web python manage.py shellfromexample_app.modelsimportTodotodo=Todo.objects.create(text='Setup django nosql')# you should see this reflected in the 'todos' collection in Firebase# note: you need to manually refresh the db view when adding a new collection# you should see the rest of these updates in realtime# try update:todo.done=Truetodo.save()# you should see your change reflected in firestore# delete it:todo.delete()# it's gone from Firestore!Take it asyncIf you're using something like celery or django-rq, you can make your signals async by wrapping the base function in a@shared_task. e.g.:fromdjango.db.models.signalsimportpost_save,post_deletefromdjango.dispatchimportreceiverfromdjango.confimportsettingsfromdjango_nosql.signalsimport(sync_readonly_db,SYNC_TYPE)fromceleryimportshared_task# create a shared task that wraps `sync_readonly_db`@shared_taskdeffirebase_sync(instance,created):sync_readonly_db(instance,SYNC_TYPE.UPDATE,created)@shared_taskdeffirebase_sync_remove(instance):sync_readonly_db(instance,SYNC_TYPE.DELETE,False)# call that function in a delayed manner@receiver(post_save,dispatch_uid="django_nosql.sync")defsync_readonly_db(sender,instance,created,**kwargs):firebase_sync.delay(instance,created)@receiver(post_delete,dispatch_uid="django_nosql.sync.delete")defsync_remove_readonly_db(sender,instance,**kwargs):firebase_sync_remove.delay(instance)ContributingDeploy to pip# bumpversion:
bumpversion {major|minor|patch}
# push to gitlab
git push origin master
# gitlab CI does the rest
Package: django-nosqladmin
Many NoSQL databases, mostly the Document based ones, translate into Python as a list of dictionaries, right? So why do us developers try to staple document databases into Django’s traditional style relational introspection and tools? It’s like we’re trying to add object impedance mismatch to something that avoids it in the first place.Taking lessons learned from django-mongonaut, django-nosql-admin is an introspection tool for NoSQL databases. Our original test case is MongoDB, but if this works we’ll invite authorship of interfaces for other NoSQL databases.FundamentalsDisplay the results of lists of dictionariesmongoadmin.py features:Define a collectionOnly show ObjectId by defaultCan add search fields which attempt to searchCan add list fields which try to displayDefine which collections are displayed.Sample mongoadmin.py file:# mongoadmin.py
class ProfileAdmin(MongoAdmin):

    collection = 'Profile'
    search_fields = ['username']
    list_fields = ['username']

    def has_view_permission(self, request):
        return True

class ArticleAdmin(MongoAdmin):

    collection = 'Article'
    search_fields = ['title',]
    list_fields = ['title','create_date']


admins = [ProfileAdmin(), ArticleAdmin()]
Package: django-note
Note is a simple Django app to conduct Web-based notes.Detailed documentation is in the “docs” directory.Quick startAdd “note” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'note',
]Include the todo URLconf in your project urls.py like this:url(r'^note/', include(note.urls, namespace='note')),Runpython manage.py migrateto create the note models.Start the project’s server and login on your django-website.Visithttps://your_django_website_url_part/note/to use the note app.
Package: django-notes
A simple application to allow you to attach notes to models.InstallationNotes uses generic relations to handle attaching themselves to models. So installation is basically just like adding a generic relation item to your model.Add ‘notes’ to your INSTALLED_APPS variableImport the Note model:from notes.models import NoteAdd the note inline to your model’s admin def in your admin.py file:from notes.admin import NoteInlineclass YourModelAdmin(admin.ModelAdmin):inlines = [ NoteInline, ]To enable easy management you can add a hook to your model:notes=generic.GenericRelation(Note)UsageFollow the steps above (including 4) and you should have access to all the notes at instance_of_yourmodel.notes_set.all():>>> object = YourModel.objects.get(pk=1)
>>> notes_for_object = object.notes_set.all()Simple.
Package: django-notifications2
django-notificationsQuick startAdd "django_notifications" to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
        ...
        'django_notifications',
    ]Runpython manage.py migrateto create the django_notifications models.Settings:MAX_ATTEMPTS_NUMBER: [DEFAULT=3] 
How many times should we try to send a notification. If the number is reached, the notification will be removed.Examplesa) Creating e-mail notification:NotificationQueue.objects.create(custom_notification_id='USER1_LOGGED_IN_070920202201',backend='email',data={'subject':'Login from a new device','body':'<h1>It looks like you’ve recently signed in.....</h1>','to':'email@localhost'})...fromdjango_notifications.helpersimportEmailNotificationQueueManagementEmailNotificationQueueManagement().send_notifications()# if the notification is not sent, it will go to the error queuefromdjango_notifications.helpersimportEmailNotificationErrorQueueManagementEmailNotificationErrorQueueManagement().send_notifications()
Package: django-notification-sender
NotificationsPluggable app to centralize notification configuration.Available settings:NOTIFICATIONS_MAIL_FROM- sender for mail notifications (falls back tosettings.DEFAULT_FROM_EMAIL)NOTIFICATIONS_SLACK_APP_TOKEN- Slack app token to be used to post the notifications using API, not incoming webhook (no default, set it or slack won't work!)To use external notifications make sure to update your projecturls.pyto add a valid path for notificationsurlpatterns = [
    ...
    path(
        'api/notifications/', include(('notifications.urls', 'notifications'), namespace='notifications')
    ),
    ...
]This would allow external notifications to be POSTed toapi/notifications/notify/
Package: django-notifications-rest
django-notifications-restDocumentationdjango-notifications-restprovides rest endpoints fordjango-notifications-hq.RequirementsPython 3.5, 3.6, 3.7, 3.8Django 2.2, 3.0, 3.1django-notifications-hq latest versiondjangorestframework latest versionInstallationInstallation usingpip. You need to manually install the requireddjango-notifications-hqanddjangorestframeworkpackages.$ pip install django-notifications-restor get it from source$ git clone https://github.com/yhdelgado/django-notifications-rest.git
$ cd django-notifications-rest
$ python setup.py sdist
$ pip install dist/django-notifications-rest*Then to add the Django Notifications Rest to your project add the appnotifications_restto yourINSTALLED_APPSand urlconf.The app should go somewhere after all the apps that are going to be generating notifications likedjango.contrib.authINSTALLED_APPS = (
    'django.contrib.auth',
    'rest_framework',
    'notifications'.
    ...
    'notifications_rest',
    ...
)Add the notifications urls to your urlconf::urlpatterns = [
    ...
    url('^notifications/', include('notifications_rest.urls')),
    ...
]If the installed version of django>=3.1, then::from django.urls import path, include
urlpatterns = [
    ...
    path('^notifications/', include('notifications_rest.urls')),
    ...
]To run schema migration, executepython manage.py migrate.
Package: django-notifier
Send notifications (Email, SMS etc) and manage preferences and permissions per user and group.See full documentation athttp://django-notifier.rtfd.org/To register a notification:create_notification('test-notification')To send notifications:send_notification('test-notification', [user1, user2, ..])InstallationInstall viapip:$ pip install django-notifierSetupAddnotifierto INSTALLED_APPS in your django settings file.INSTALLED_APPS = (
    ...
    'notifier',
    ...
)SettingsIf you are going to use any custom backends to send notifications, add the setting NOTIFIER_BACKENDS to your settings file. If this setting is not defined, only the EmailBackend is used by default.NOTIFIER_BACKENDS = (
    'notifier.backends.EmailBackend',
    'path.to.custom.backend.CustomBackend',
)Runsyncdbormigrate(if using South) to create the necessary tables in the database.$ python manage.py syndbIf using South:$ python manage.py migrate
Package: django-notifs
Modular Notifications (InApp, Email, SMS, CustomBackend etc) for Djangodjango-notifs is a modular notifications app for Django that basically allows you to notify users about events that occur in your application E.gYour profile has been verifiedUser xxxx sent you a messageIt also allows you to deliver these notifications to any destination you want to with custom delivery channels.It also supports asynchronous notification with several pluggable delivery backends (e.g Celery, RQ etc)Examples?A tutorial on how to build aRealtime Chat application with Vue, django-notifs, RabbitMQ and uWSGIThe Repository for the chat app (Chatire) is also available ongithubDocumentationhttps://django-notifs.readthedocs.io
Package: django-notifyit
=====
NotifyItNotifyIt is a Django app to conduct Web-based notification. User can create a notification for other services.Detailed documentation is in the "docs" directory.Quick startAdd "polls" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [
...
'django-notifyit',
]Include the polls URLconf in your project urls.py like this::path('notifyit/', include('django-notifyit.urls')),Runpython manage.py migrateto create the notifyit models.Start the development server and visit POST:http://127.0.0.1:8000/notifyit/to create a notification.Visit GET:http://127.0.0.1:8000/notifyit/to get list of notifications.
Package: django-notifyme
Warningthis code is NOT ready for production yet.A framework for django projects and re-usable apps that aims to provide a clean and flexible
notification solution. Developers can emit user-centric notifications to their users without
knowing the details of how the notification will be delivered by the delivery backends.Delivery backends could emit notices as:emailstwitter messagesnotifio messagesjabberwhatever you can dream ofdjango-notifyme isNOTa replacement for request-by-request messages likedjango.contrib.messagesprovides.
Package: django-notifyme-onsite
This is a plugin forhttps://github.com/stefanfoulis/django-notifymedjango-notifyme-onsiteis a delivery backend for django-notifyme. It allows displaying notifications on the
website and keeps a list of per user notifications in the database. It contains hook for users todismissa
a sticky notification.InstallationDependencies:django-notifymepip install django-notifyme-onsiteAddnotifyme_onsitetoINSTALLED_APPSand register the backend somewhere in your project code (best in a
models.py):import notifyme.delivery
from notifyme_onsite.delivery import OnsiteStickyBackend
notifyme.delivery.backend.register(OnsiteStickyBackend)
Package: django-novaposhta
# MP-NovaposhtaDjango nova poshta ua api app.### InstallationInstall with pip:` pip installdjango-novaposhta`Add app to urls.py:`path('novaposhta/',include('novaposhta.urls')),`Addnovaposhtato INSTALLED_APPSAddNOVA_POSHTA_API_KEYto your settings.pyRunpython manage.py migrate### Refresh warehouses
To refresh warehouses you should login as staff and visit/novaposhta/refreshurl.
Old warehouse records will be removed.### RequirementsApp require this packages:django-model-search
Package: django-nox
Statistics middleware and analysis tools for djangoInstallationTo get the latest stable release from PyPi$pipinstalldjango-noxAdd all relevant apps to yourINSTALLED_APPSINSTALLED_APPS=(...,'django_nox',)Add all middleware to yourMIDDLEWAREMIDDLEWARE=(...,'django_nox.middleware.TimeLogMiddleware')Don’t forget to migrate your database./manage.pymigrateUsageRunning & Sorting ResultsOnce you’ve installed it, the request times will be log in database, and you can run this command to analyze the resulting data:$ python manage.py nox_analyzeSettingsTo configured some parmas in settings.pyNOX_SLOW_REQUESTDefault: 0Slow request. Number of rows from which a request will be assumed to be slow and store to database.Enjoy!Email me with any questions: [liangjinfeng@youmi.com](liangjinfeng@youmi.com).
Package: django-npick
Django Pick material Icon WidgetInstallpipinstalldjango-npickUsageadd templates pathadmin/change_form.htmlextra the default admin template to use js css# project/settings.pyfromdjango-npickimportTEMPLATE_PATH# 1TEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','DIRS':[TEMPLATE_PATH],# add templates path # 2'APP_DIRS':True,'OPTIONS':{)},]start an apppythonmanage.pystartappappdefine your modelfromdjango.dbimportmodelsclassIcon(models.Model):name=models.CharField(max_length=30)Add IconWidget to form then add form to Admin.# app/admin.pydjango.contribimportadminfromdjangoimportformsfromdjango_npickimportIconWidget# 3from.modelsimportBingoclassBingoForm(forms.ModelForm):name=forms.CharField(widget=IconWidget)# 4classBingoAdmin(admin.ModelAdmin):form=BingoFormfields=['name']admin.site.register(Bingo,BingoAdmin)runserverpythonmanage.pymigrate
pythonmanage.pycreatesuperuser
pythonmanage.pyrunserver
Package: django-nplusone
django_nplusoneDiscover possible N+1 queries in Django ORM at runtimeThe objective of this library is to help you discover any N+1s in your code at development time. Enable logging of
warnings by following instructions shown in Usage section. Run your Django app as usual and you will see warning logs
of any possible N+1s if found.InstallationInstall the package from PyPI usingpipas followingpip install django_nplusoneUsageOnce package is installed, you can register the package in yoursettings.pyas:import nplusone

if DEBUG:
    nplusone.show_nplusones()This should start logging possible N+1s warnings using your logger configuration. The library uses standard pythonloggingmodule and uses logger by the name ofnplusone.Ignore specific warningsYou can ignore warning for a specific statement by ending the statement with# NO-NPLUSONE.TestYou can test the N+1 warning logging by putting some code as shown below somewhere in your application code that you
know will get executed. Say you have a modelUserwith a foreign key fieldorgtoOrganizationmodel.user = User.objects.all()[0]
print(user.org)You should see a log message with a message that looks like this:... Possible N+1 for model: User, field: org, relationship: ForwardManyToOne, file: <?>, function: <?>, line: <?>, statement: <?>where<?>will have correct values for the fields derived from call stack pointing you to the statement that has
possible N+1