Saravanan666/pypi-org huggingface dataset:
Package: django-toggled-widgets
Django Toggled WidgetsThis package makes it possible to toggle between fields in the Django admin. When a form containing toggled fields is submitted, any field that did not have visibility upon submission is automatically set empty in the cleaned data.UsageAdd "toggled_widgets" to your `INSTALLED_APPS setting.Addtoggled_widgets.ToggledWidgetFormMixinto the MRO of any form class that requires the toggle behavior.Set the form class'toggle_groupsattribute to an iterable of tuples that describe the toggle relationship.Add `toggled_widgets.ToggledWidgetAdminMixin to the MRO of any model admin class that uses a form containing the toggle behavior.Optionally addtoggled_widgets.ToggledWidgetMixinto the MRO of the toggled widget classes in order to gain more control over the appearance of the toggle control (e.g. by defining themetafield_labelto customize the toggle control's label).ModelFormconfigurationIn the simplest implementation, each element in the tuples contained in the form class'toggle_groupsattribute is a string whose value is a field name. The admin form will provide a control to toggle between these fields. For example:classSomeModelForm(ToggledWidgetFormMixin,ModelForm):toggle_groups=[('some_field','some_other_field')]Any element in the tuple may also be an iterable containing multiple field names. In this case, any field name past the first in this iterable will toggle sympathetically along with the field named in the first item.classSomeModelForm(ToggledWidgetFormMixin,ModelForm):toggle_groups=[('some_field',('some_other_field','some_third_field'))]
Package: django-toggle-m2m
django-toggle-m2mInstallationpipinstalldjango_toggle_m2mUsage in modelsfromdjango.dbimportmodelsfromdjango_toggle_m2m.toggleimportToggleManyToManyclassPublication(models.Model):title=models.CharField(max_length=32)classArticle(models.Model,ToggleManyToMany):# ______________________^# Extend ToggleManyToMany classheadline=models.CharField(max_length=256)publications=models.ManyToManyField(Publication)# Define M2M fields that are toggleableTOGGLEABLE_FIELDS=('publications',)Relation togglingarticle=Article.objects.create(...)publication=Publication.objects.create(...)article.toggle_publications(instance=publication)# Will be addedarticle.toggle_publications(instance=publication)# Will be removedDevelopmentgitclonehttps://github.com/wencakisa/django-toggle-m2m.git
pipinstalldjango_toggle_m2mInteresting fact-https://code.djangoproject.com/ticket/20686
Package: django-toggle-switch-widget
django-toggle-switch-widgetDisplay toggle switch in stead of checkbox for BooleanField in django admin site.Installpipinstalldjango-toggle-switch-widgetWidget init parametersattrs: Inherit from CheckboxInput.check_test: Inherit from CheckboxInput.round: Default to False. If round=True, display round switch. If round=False, display squire switch.klass: Default to empty string "". Pre-setted klass are:django-toggle-switch-success: Show success color (green, #06ad3d) while toggle on.django-toggle-switch-warning: Show warning color (orange, #ff6a00) while toggle on.django-toggle-switch-danger: Show danger color (red, #ba2121) while toggle on.django-toggle-switch-dark-primary: Show dark primary color (darkcyan, #417690) while toggle on.django-toggle-switch-primary: Show primary color (cadetblue, #79aec8) while toggle on.Usagepro/settings.pyINSTALLED_APPS=[...'django_toggle_switch_widget',...]app/model.pyfromdjango.dbimportmodelsclassTestModel(models.Model):title=models.CharField(max_length=64,help_text="Please input model title.")published=models.BooleanField(verbose_name="Is this test model published.")is_demo=models.BooleanField(help_text="Is this a demo test model?")app/admin.pyfromdjango.contribimportadminfromdjango.formsimportModelFormfromdjango_toggle_switch_widget.widgetsimportDjangoToggleSwitchWidgetfrom.modelsimportTestModelclassTestModelForm(ModelForm):classMeta:model=TestModelfields="__all__"widgets={"published":DjangoToggleSwitchWidget(klass="django-toggle-switch-dark-primary"),"is_demo":DjangoToggleSwitchWidget(round=True,klass="django-toggle-switch-success"),}classTestModeldmin(admin.ModelAdmin):form=TestModelFormadmin.site.register(TestModel,TestModeldmin)TipsIt's better to use together with django-checkbox-normalize app.Releasev0.1.0 2020/03/02First release.v0.1.1 2020/09/09Add License.v0.1.3 2023/09/15Doc update.
Package: django-token
django-tokenSimple token based authentication for Django.This draws inspiration from the Django Rest Framework token based authentication scheme but allows you to use it without using Django Rest Framework.InstallingInstall from pipsudo pip install django_tokenAdd the middleware to your MIDDLEWARE_CLASSESMIDDLEWARE_CLASSES=(# Other middleware'django_token.middleware.TokenMiddleware',)Add the authenticaton backend to your AUTHENTICATION_BACKENDSAUTHENTICATION_BACKENDS=('django.contrib.auth.backends.ModelBackend','django_token.backends.TokenBackend')Creating tokensYou can create tokens for users using whatever workflow you'd like.fromdjango_token.modelsimportTokentoken=Token.objects.create(user=myuser)If you REALLY want to reset all the tokens in your database, you can use the reset_tokens management command.python manage.py reset_tokensThis is useful when you've just installed django-token, but is otherwise dangerous :)Token in headersThe user's token should be passed in on every request in the HTTP authorization header.Usingrequestsimportrequestsresponse=requests.get("http://myserver.com/api/stuff",headers={"Authorization":"token r454f2529f2cd27e1722e67a624b2b18335e6c21"})
Package: django-token-bucket
A token bucket implementation for Django to implement rate limiting
on individual user actions, for example submitting a form.InstallationInsatall:pip install django-token-bucketadd it to your installed apps:INSTALLED_APPS = [
    '...',
    'django_token_bucket'
]run migrations:./manage.py migrate django_token_bucketExamplesexample for consuming a token on Form validation:INVITATION_MAX_TOKENS = 5
INVITATION_FILL_RATE = 300  # a token each 300 seconds

def clean(self):
    cleaned_data = super(InvitationForm, self).clean()
    bucket = TokenBucket.get(identifier='invitations_sent',
                       ref_object=self.user,
                       max_tokens=INVITATION_MAX_TOKENS,
                       fill_rate=INVITATION_FILL_RATE,
                       whatfor='invitations')
    try:
        bucket.consume(1)
    except bucket.TokensExceeded as e:
        raise forms.ValidationError(e.get_message())
    return cleaned_datatheTokensExceeded.get_messagefunction takes the Timezone to give the retry time in as optional parameter.
Package: django-token-manager
django-token-managerA Django Rest Token Authentication system like telegram which will be using JWT as core with extended features.FeaturesValidation of tokens first with jwt algorithms to filter not valid token formats, before hitting database.Able to see list of active tokens of each user_idAble to delete each token if neededAble to remove all other tokens of each users and keep just existing oneFetch useful info for each token request like os, ip and ...Why django-token-managerReasonto use this module is that by default if you are using jwt system for
token authorization of client, you don't have control on existing tokens.
Of course you can set a expire date for each token. But if the expiration date isn't arrived yet,
you can't delete this token.
What happens if you want to delete all sessions of a user. With jwt you don't have control on it, and you
should wait for expiration of token to be arrived.The purpose of this package, is to give more control on jwt tokens. For this there will be a
lookup_id in payload of each jwt token. First token with be validated with jwt algorithms.
Then payload lookup_id will be checked on database and if available will give access.
And with this solution no need to query on a big string (session string) on database,
if the jwt token is valid, will just query on a db_index ed fieldlookup_id.RequirementsTo use this package following needed. if not provided will be installed automatically.Django>=2.0
djangorestframework>=3.0
django-jalali>=3.1.0
django-rest-captcha>=0.1.0InstallationNote:This package is well tested ondjango>=2.0. But if you are using older versions can be
used with minor changes in structure.install using pip:$ pip install django-token-managerUsageNow register app in yoursettings.pyfile.INSTALLED_APPS = [
    "token_manager",
]In yoursettings.py, addJSONWebTokenAuthenticationto Django REST framework'sDEFAULT_AUTHENTICATION_CLASSES.REST_FRAMEWORK = {
    ...,
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'token_manager.authentication.JSONWebTokenAuthentication',
        ...
    ),
}This package usesuser-agentspackage for fetching user agent info like device OS, IP address and ...
So you should register below to be able to use it:MIDDLEWARE = [
    ...,
    'django_user_agents.middleware.UserAgentMiddleware',
]Remember to apply migration files in database:python manage.py migrateTo get token:curl-XPOST-d"username=admin&password=admin""http://localhost:8000/token/get/"Verify token:curl-H"Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb29rdXBfaWQiOjUsInVzZXJfaWQiOjEsInVzZXJuYW1lIjoiYWRtaW4iLCJleHAiOjE1OTg1MjY4MjEsImVtYWlsIjoiIn0.l6JyGgAs_hBRejX1BpvA7PjubM2m89lV35PTVUBnV_I""http://localhost:8000/token/manage/"
Package: django-token-tools
django-token-toolsSuite of Django tools around token authenticationSettingsTOKEN_TIMEOUTValidity time of a token in seconds.token_tools.generator.TokenGeneratorThis module is a generic version of the token generator used by django for
reset password URLs.
You should implementtoken_idb64and_make_hash_valueto make it work.token_idb64This method must return a base64 encoded data, it's used to validate the token, and can embed data.
It must not embed critical data, it can be simply decoded._make_hash_valueThis is the hash value, it must be unique by user. It will be used to generate the token, and to validate a token
with idb64 content.0.2.0Use default settings for TOKEN_TIMEOUTSupport Dajngo 4.1Support Python 3.10Move CI to github actions0.1.2           (2019-12-17)Documentation improvementadd support for django 3.0 and python 3.80.1.0  (2019-10-15)First release
Package: django-tokko-auth
InstallInstall DjangoPlugin Packagepipinstall-egit@github.com:TokkoLabs/authorization.gitImport & Configure dj-pluginyour-project/settings.py# Add app to installed appsINSTALLED_APPS=['tokko-auth']# Also add declare app's middlewareMIDDLEWARE=[# Has request JWT?"tokko-auth.middleware.HasJWTMiddleware",# JWT has required NAMESPACE?"tokko-auth.middleware.NamespaceAuthorizationMiddleware",# Fill "request.user" attribute"tokko-auth.middleware.UserRecoverMiddleware",]# Finally, declare your AUTH0_DOMAINAUTH0_DOMAIN='my-auth-sub-dns.auth0.com'UsageAPI required NAMESPACEyour-project/settings.py# API required NAMESPACEAUTH_API_NAMESPACE='my-service-namespace'View & Mutation required SCOPESResticciones de acceso basado en scopes para la viewsome_ufo_secrets.fromauthorization.decoratorsimporthas_permission# Require todos los scopes@has_permission('x-files:agent','alien:believer',has_all=True)defsome_ufo_secrets(request):...# Al menos un scope@has_permission('scully:agent','mulder:agent',at_least_one=True)defsome_ufo_secrets(request):...SettingsEnvironment VarsEsta aplicación observa un conjunto de variables de entorno configurables, las cuales pueden modificar drásticamente su
funcionamiento.RequiredNameDescriptionTypeDefaultAUTH0_DOMAINAuth0 Domain. Ej:{my-project}.auth.com. Si esta variable no esta correctamente configurada, se emitirá un exceptionEnvVarNotInitializedString-OptionalNameDescriptionTypeDefaultAUTH_FAIL_SAFE_ENABLERemueve errores de validaciónBooleanFalseAUTH_USERINFO_ENABLEAgrega/userinfodata alrequest.userBooleanFalseAUTH_API_NAMESPACEScopes requeridos a nivel API, estos se validaran en cada requestList[ ]AUTH_BEAUTIFY_ERROR_RESPONSEFormatea los errors a JSONResponse, se auto-deshabilita sobre GQLBooleanFalseAUTH_FULL_DISABLEDDesactiva validacion de AuthBooleanFalseAUTH_ALLOW_PRODUCTIVE_SHUTDOWNPermite desactivar la validacion de Auth en productivoBooleanFalseSAMPLES_ARE_ENABLEAgregaViews, Mutation & Queries de ejemploBooleanTrueTestingLocal environmentUnit Testpythonmanage.pytestauthorization.tests.unitService Testpythonmanage.pytestauthorization.tests.serviceDocker environmentUnit Test# Require: docker-compose up [-d] [--build]docker-composeexecappbash-c"python manage.py test authorization.tests.unit"Service Test# Require: docker-compose up [-d] [--build]docker-composeexecappbash-c"python manage.py test authorization.tests.service"GlossaryOAuthMiddlewareContributingPlease readCONTRIBUTING.mdfor details on our code of conduct, and the process for submitting pull requests to project.
Package: django-tokko-rpc
Install# Virtual Environment(venv)pipinstalldjango_tokko_rpc# Main Python3 environmentsudo-Hpip3installdjango_tokko_rpcUsageAdd to {your-project}/settings.pyINSTALLED_APPS=["other-apps","...","django-tokko-rpc"# <- Django TokkoRPC Plugin]Testingpython./manage.pytestdjango_tokko_rpcgoBack
Package: django-tokyo-sessions
This is a session backend for Django that stores sessions in a Tokyo Cabinet
database, which communicates via Tokyo Tyrant using the PyTyrant library.  Tokyo
Cabinet is a key-value store similar to BDB.The advantage to using this over other solutions is that your data is persistent
unlike memcached, and Tokyo Cabinet is designed to store key-value data like
this, so performance is much closer to that of memcached than with a database.Installing django-tokyo-sessionsEither download the tarball and runpython setup.py install, or simply
use easy install or pip like soeasy_installdjango-tokyo-sessions.Settokyo_sessions.tokyoas your session engine, like so:SESSION_ENGINE = 'tokyo_sessions.tokyo'Add settings describing where to connect to the Tokyo Tyrant database:TT_HOST = '127.0.0.1'
TT_PORT = 1978That’s it.  Hopefully this backend gives you all the better performance while
still not sacrificing persistence.
Package: django-tonnikala
Tonnikala templates - powered by ponies!Django integration forthe one-ton templating language.To use, install (withpip install django-tonnikalaorpython setup.py install) and configure your settings:TEMPLATES=[{'BACKEND':'django_tonnikala.backends.Tonnikala','DIRS':[],'APP_DIRS':True,'OPTIONS':{# TODO},},]And add your templates toyour_app/tonnikala/!Running the example projectThe git repository includes an example projectpython3-mvenvvenv
pipinstall-rexample_project/requirements.txt
pythonexample_project/manage.pymigrate
pythonexample_project/manage.pyrunserverAnd then visithttp://localhost:8000
Package: djangotoolbox
Djangotoolbox provides a common API for running Django on
non-relational/NoSQL databases (currently viaDjango-nonrel).Indjangotoolbox.dbyou can find base classes for writing
non-relational DB backends. ReadWriting a non-relational Django backendfor more information.Indjangotoolbox.fieldsyou can find several common field
types for non-relational DB backends (ListField,SetField,DictField,RawField,BlobField).Thedjangotoolbox.adminmodule provides admin overrides for
makingdjango.contrib.authwork correctly in the admin UI.
Simply add'djangotoolbox'toINSTALLED_APPSafterdjango.contrib.admin. This will disable features that
require JOINs. If you still need permission handling you should
use thenonrel permission backend.
Package: django-toolkit
A collection of tools and helpers for use with Django.InstallationYou can install django-toolkit either via the Python Package Index (PyPI)
or from bitbucket.To install using pip;pipinstalldjango-toolkitFrom github;pipinstallgit+https://github.com/alexhayes/django-toolkit.gitUsageThe code is largely undocumented at this stage but should be considered stable
for production use.To get to a 1.0.0 release will require many more tests and documentation.ContributingYou are encouraged to contribute - please fork and submit pull requests. To get
a development environment up you should be able to do the following;gitclonehttps://github.com/alexhayes/django-toolkit.gitcddjango-toolkitpipinstal-rrequirements/default.txtpipinstal-rrequirements/test.txt./runtests.pyAnd to run the full test suite, you can then run;toxNote tox tests for Python 2.7, 3.3, 3.4 and PyPy for Django 1.6, 1.7 and 1.8.
You’ll need to consolute the docs for installation of these Python versions
on your OS, on Ubuntu you can do the following;sudoapt-getinstallpython-software-propertiessudoadd-apt-repositoryppa:fkrull/deadsnakessudoapt-getupdatesudoapt-getinstallpython2.7python2.7-devsudoapt-getinstallpython3.3python3.3-devsudoapt-getinstallpython3.4python3.4-devsudoapt-getinstallpypypypy-devAuthorsAlex Hayes <alex@alution.com>
Package: django-tools-contact
Django Tools ContactDjango Tools Contact is a simple Django app to manage a company contact information and contacts
requests from a formInstallationInstall with pip installdjango-tools-contact.Adddjtools.contactto your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'djtools.contact',
]Add your Google Maps API key nd your contact information in your project settings:DJTOOLS_CONTACT_GMAPS_APIKEY = "ABCDE123"
DJTOOLS_CONTACT_SITE_DOMAIN = "www.example.com"
DJTOOLS_CONTACT_MAIL_FROM = "no-reply@example.com"
DJTOOLS_CONTACT_MAIL_TO = ["admin@example.com"]It has a dependency overdjango-recaptcha. Follow their instructions as well:Django ReCaptcha.You can use theContactRequestViewlike this:from djtools.contact.views import ContactRequestView


urlpatterns = [
    path('contact/', ContactRequestView.as_view(), name='contact'),
]Runpython manage.py migrateto create the contact models.If you want to show the comapny contact information in the same page as the contact form
you need to enable this settingDJTOOLS_CONTACT_INFO=True, then start the development server and
visithttp://127.0.0.1:8000/admin/to create add the contact information (you'll need the Admin app
enabled).Visithttp://127.0.0.1:8000/contact/to see the contact information and send contact requests.Referenceshttps://github.com/pydanny/cookiecutter-djangopackage/
Package: django-tools-contact-requests
Django Tools Contact RequestsSimple Django app to manage contact requestsInstallationInstall with pip installdjango-tools-contact-requests.Adddjtools.contactrequeststo your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'djtools.contactrequests',
]Add your contact information in your project settings:DJTOOLS_CONTACTREQUESTS_SITE_DOMAIN = "www.example.com"
DJTOOLS_CONTACTREQUESTS_MAIL_FROM = "no-reply@example.com"
DJTOOLS_CONTACTREQUESTS_MAIL_TO = ["admin@example.com"]It has a dependency overdjango-recaptcha. Follow their instructions as well:Django ReCaptcha.You can use theContactRequestViewlike this:from djtools.contactrequests.views import ContactRequestView


urlpatterns = [
    path('contact/', ContactRequestView.as_view(), name='contact'),
]Runpython manage.py migrateto create the contact models.
Package: django-toolset
Django Toolset is a simple package with a few useful models, views,
templatetags, and other functions that can be used to save time when writing a
Django application.For specific information about what’s included, view thedocs.RequirementsDjango Toolset requires Django 1.8 or later.Getting ItYou can get Django Toolset by using pip:$ pip install django-toolsetIf you want to install it from source, grab the git repository from GitHub and run setup.py:$ git clone git://github.com/codezeus/django-toolset.git
$ cd django-toolset
$ python setup.py installInstalling ItTo enabledjango_toolsetin your project you need to add it toINSTALLED_APPSin your projectssettings.pyfile:INSTALLED_APPS = (
    ...
    'django_toolset',
    ...
)Getting InvolvedOpen Source projects can always use more help. Fixing a problem, documenting a
feature, and adding translations in your language. If you have some time to spare
and like to help us, please submit a pull request.
Package: django-tools-seo
Django Tools SEOSimple Django app to manage project SEO like Google AnalyticsInstallationInstall with pip installdjango-tools-seo.Adddjtools.seoto your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'djtools.seo',
]If you want to add the Google Analytics Tracking Script you should
3.1 Add you Google Analytics Tracking ID to your settings file:GOOGLE_ANALYTICS_TRACKING_ID = "UA-TESTID"3.2 Add a context processor to your settings file:TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'djtools.seo.context_processors.google_analytics',
            ],
        },
    },
]3.3 Include thegoogle_analytics.htmlinto your base template:{% include "djtools/seo/google_analytics.html" %}
Package: django-tools-socialnetworks
Django Tools SocialNetworksSimple Django app to manage a website social network linksInstallationInstall with pip installdjango-tools-socialnetworks.Adddjtools.socialnetworksto your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'djtools.socialnetworks',
]3.1 Add the context processor to your settings file if need the social networks in all your pages.TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'djtools.socialnetworks.context_processors.social_networks',
            ],
        },
    },
]3.2 Or extend theget_contextfunction of your view like this:def get_context_data(self, **kwargs):
    context = super().get_context_data(**kwargs)
    context['social_networks'] = SocialNetwork.get_social_networks()
    return contextRun migrations commandspython manage.py migrateInclude social_networks.html snippet in your template or override it.{% include "djtools/socialnetworks/social_networks.html" %}
Package: django-tooltips
django-tooltips===============Manageable bootstrap tooltipsRequirements============-  Django (duh)-  Bootstrap-  JqueryInstallation============Install the app via pip:::$ pip install django-tooltipsAdd ``tooltips`` to your installated apps:.. code:: pythonINSTALLED_APPS = (...'tooltips',...Add the processor to your ``TEMPLATE_CONTEXT_PROCESSORS``:.. code:: pythonTEMPLATE_CONTEXT_PROCESSORS = (...'tooltips.processors.tooltips',)Include this in your templates (eg, ``base.html``):{% include "tooltips/tooltips.html" %}And run the migrations:::$ manage.py migrate tooltipsNow, whenever you add a tooltip via the admin, it will appear on yourpages just after the element you provided via the javascript selector:Preview=======Clientside:.. figure:: https://raw.github.com/svdgraaf/django-tooltips/master/preview.png:alt: admingadmingAdmin:.. figure:: https://raw.github.com/svdgraaf/django-tooltips/master/admin.png:alt: admingadmingCaveats=======As the selectors are plain javascript selectors, you can use all themagic you want. But don't use very wide selectors like ``div`` or``div:contains("")``, those will probably bring your browser to astandstil :) YMMV
Package: django-toots
django-tootsCreate and delete toots in a Django project.This package takes advantage of theMastodon.pyfunctionalities to connect it to a Django Backend.Set upInstall from PyPIpython -m pip install django-tootsAdd the package to your settings INSTALLED_APPSINSTALLED_APPS=[..."django_toots",...]Add the following settings to your Django project.Example:importosfromdotenvimportload_dotenvload_dotenv()...# django-tootsMASTODON_ACCESS_TOKEN=os.environ.get("MASTODON_ACCESS_TOKEN","")MASTODON_API_BASE_URL="https://fosstodon.org"Run migrationspython manage.py migrateUsageTODO: Document this!Create a simple tootfromdjango_toots.modelsimportToot# create a toot in the dbt=Tweet.objects.create(text="Hi, this is my toot using django-toots and Mastodon.py")# publish itt.publish()