Saravanan666/pypi-org huggingface dataset:
Package: django-ognajd
ognajDv0.2.1Django app which handles ORM objects' versions.DescriptionognajDis Django-compactible application which handles versionning for ORM models.
Main feature is forognjaDto be a "plug-in" Django application, thus capable to
work with "little-to-no" configuring and changes to Django project.Featuresognajdstores objects' versions in own table, relied oncontenttypesapplication.ognajD@v0.2.1can:catch object's save / update signalsstore snapshot of object in DB with:timestampserialized versionhashobject version may be serialized (currently, only JSON) as:diff with previous version(by default)raw dumpsinline with versione for admin modelsUsage examplesample-projectis a showcase django project, based on famouspollsapplication.
You can reference to it for usage cases, examples, testing.You must never deploysample_projectin
production due to exposedSECRET_KEY.Getting StartedDependenciesPython packagesdjango~=3.2.7might work on lesser versions, not testedjsondiff~=1.3.0might work on lesser versions, not testedDjango applicationscontenttypesInstallingUsing Python Package Indexmake sure to use latestpip:python3-mpipinstall--upgradepipinstalldjango-ognajd:python3-mpipinstalldjango-ognajdOR download package from releasesdownload release asset (.tar.gzor.whl)make sure to use latestpip:python3-mpipinstall--upgradepipinstalldjango-ognajdfrom file:python3-mpipinstall/path/to/downloaded/asset.tar.gz# or .whlOR clone from repositoryclone project:gitclone\--depth=1\--branch=master\git@github.com:omelched/django-ognajd.git\</path/to/downloads>move/django-ognajd/ognajdsolely to folder containing django appsmv</path/to/downloads>/django-ognajd/ognajd\</path/to/django/project/apps>remove leftoversrm-rf</path/to/downloads>/django-ognajdConfiguringInstalling applicationAddognajdtoINSTALLED_APPSin your Django projectsettings.py.
Make sure it is installedbeforedjango.contrib.admin.If you installed packagethe third way,</path/to/django/project/apps>must be added toPYTHONPATH. If you not sure add code below in your Django projectmanage.pybefore callingmain():sys.path.append('</path/to/django/project/apps>')Registering modelsTo register your model as eligible for versioning add attribute-classVersioningMetato model class definition.
For typing, linters, autocompletion tyou can inherit fromognajd.models.VersioningMeta.Then set preferred options.e.g:# .../your_app/models.pyfromdjango.dbimportmodelsfromognajd.modelsimportVersioningMetaclassQuestion(models.Model):classVersioningMeta(VersioningMeta):store_diff=False...# fields' definitionsVersioningMetaoptionsNameDescriptionTypeDefaultenabledTrue: if model will be versionedFalse: if will notboolTruestore_diffTrue: model's history will be stored as diffsFalse: as dumpsboolTruesave_empty_changesTrue: if empty changes will be registeredFalse:  if will notboolTrueAuthors@omelched(Denis Omelchenko)ContributorsChangelistognajDversion history and changelist available atreleasespage.LicenseThis project is licensed under theGNU APGLv3License - see theLICENSEfile for details.AcknowledgmentsInspiration, code snippets, etc.polls showcase app code fromsample-djangoindex incrementer at model save fromtinfoilboy
Package: django-ogp-view
django-ogp-viewViewクラスにOGP (The Open Graph protocol)を適応させるライブラリです。本ライブラリのViewMixinを継承させることで、ogp metaタグの実装が簡略化できます。画面ごとにカスタマイズすることもできます。SEO (Search Engine Optimization)対策に最適です。導入ライブラリをインストールする。pipinstalldjango-ogp-viewor
pipinstallgit+https://github.com/taogya/DjangoOgpView.gitsettings.pyに以下を追加する。INSTALLED_APPS=[:'django_ogp']OGP_SITE_PROPERTY_MODEL='django_ogp.OgpSiteProperty'OGP_LOCALE_MASTER_MODEL='django_ogp.OgpLocaleMaster'OGP_MIMETYPE_MASTER_MODEL='django_ogp.OgpMimeTypeMaster'migrateを行う。pythonmanage.pymakemigrationspythonmanage.pymigrateOGP用のプロパティを設定する。OgpSitePropertyサイト内共通のプロパティ。OgpBasicPropertyページごとのプロパティ。OgpCustomPropertyカスタムプロパティ。JSONで指定する。JSONについて, keyはpropertyの名称, valueはcontentの値で指定する。ViewにOgpViewMixinを継承し, 割り当てるプロパティのレコードを割り当てる。fromdjango.viewsimportViewfromdjango_ogp.viewimportOgpViewMixinfromdjango_ogp.modelsimportOgpBasicPropertyclassYourView(View,OgpViewMixin):ogp=OgpBasicProperty.objects.first():以下のようにhtmlファイルにdjango_ogp用のタグを追加する。{% load django_ogp %}<!DOCTYPE html><htmllang="en"prefix="{{ view.ogp_global_prefix }}"><headprefix="{{ view.ogp_prefix }}">{% add_ogp_meta %}
    :Models補足マイグレーションファイルにはマスターデータ自動生成スクリプトが含まれています。不要なデータがありましたら, 管理者画面にて削除するかマイグレーションファイルを修正してください。以下のモデルはswappableなモデルです。OgpSitePropertyOgpLocaleMasterOgpMimeTypeMaster
Package: django-ohm2-addresses-light
django-ohm2-handlers-light source code=============================Installation:#. Create a Python +3.5 virtualenv#. Install dependencies::- ohm2_handlers_light#. Add 'ohm2_countries_light' to installed apps::INSTALLED_APPS = [''''ohm2_countries_light',...]#. Create tables::./manage.py migrateModels------ohm2_countries_light comes with one basic Country models:Variables---------OHM2_COUNTRIES_LIGHT_FLAGS_SMALL_BASE_PATH: path to small flag images (the pages comes with default ones)API - v1--------
Package: django-ohm2-backoffice-light
django-ohm2-handlers-light source code=============================Installation:#. Create a Python +3.5 virtualenv#. Install dependencies::- ohm2_handlers_light#. Add 'ohm2_countries_light' to installed apps::INSTALLED_APPS = [''''ohm2_countries_light',...]#. Create tables::./manage.py migrateModels------ohm2_countries_light comes with one basic Country models:Variables---------OHM2_COUNTRIES_LIGHT_FLAGS_SMALL_BASE_PATH: path to small flag images (the pages comes with default ones)API - v1--------
Package: django-ohm2-countries-light
django-ohm2-handlers-light source code=============================Installation:#. Create a Python +3.5 virtualenv#. Install dependencies::- ohm2_handlers_light#. Add 'ohm2_countries_light' to installed apps::INSTALLED_APPS = [''''ohm2_countries_light',...]#. Create tables::./manage.py migrateModels------ohm2_countries_light comes with one basic Country models:Variables---------OHM2_COUNTRIES_LIGHT_FLAGS_SMALL_BASE_PATH: path to small flag images (the pages comes with default ones)API - v1--------
Package: django-ohm2-handlers
=====OHM2 Handlers=====Handlers is a complete Django app to conduct general methods and database accessDetailed documentation is in the "docs" directory.Quick start-----------1. Add "ohm2_handlers" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'ohm2_handlers',)2. Include the handlers URLconf in your project urls.py like this::url(r'^ohm2_handlers/', include('ohm2_handlers.urls')),3. Run `python manage.py migrate` to create the handlers models.
Package: django-ohm2-permissions-light
django-ohm2-handlers-light source code=============================Installation:#. Create a Python +3.5 virtualenv#. Install dependencies::- ohm2_handlers_light#. Add 'ohm2_countries_light' to installed apps::INSTALLED_APPS = [''''ohm2_countries_light',...]#. Create tables::./manage.py migrateModels------ohm2_countries_light comes with one basic Country models:Variables---------OHM2_COUNTRIES_LIGHT_FLAGS_SMALL_BASE_PATH: path to small flag images (the pages comes with default ones)API - v1--------
Package: django-oidc
This module makes it easy to integrate OpenID Connect as an authentication source in a Django project.Behind the scenes, it uses Roland Hedberg’s great pyoidc library.QuickstartInstall djangooidc:# Latest released package:
pip install django-oidc

# Latest code - unstable!
pip install git+https://github.com/marcanpilami/django-oidc.gitThen to use it in a Django project, add this to your urls.py:url(r'openid/', include('djangooidc.urls')),Then add the following items to your settings.py:add‘djangooidc.backends.OpenIdConnectBackend’to AUTHENTICATION_BACKENDSafterthe default‘django.contrib.auth.backends.ModelBackend’set LOGIN_URL = ‘openid’add the specific OIDC parameters (change the absolute URLs to yours):# Information used when registering the client, this may be the same for all OPs
# Ignored if auto registration is not used.
OIDC_DYNAMIC_CLIENT_REGISTRATION_DATA = {
    "application_type": "web",
    "contacts": ["ops@example.com"],
    "redirect_uris": ["http://localhost:8000/openid/callback/login/", ],
    "post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/", ]
}

# Default is using the 'code' workflow, which requires direct connectivity from your website to the OP.
OIDC_DEFAULT_BEHAVIOUR = {
    "response_type": "code",
    "scope": ["openid", "profile", "email", "address", "phone"],
}The configuration above is enough to use OIDC providers (OP) that support discovery and self client registration.
In addition, you may want to use a specific OpenID Connect provider that is not auto-discoverable. This is done
by adding items to the OIDC_PROVIDERS dictionary. See full documentation for parameter names.For example, an Azure AD OP (V1 endpoint, as V2 does not support code flow yet) would be:OIDC_PROVIDERS = {
    "Azure Active Directory": {
        "srv_discovery_url": "https://sts.windows.net/aaaaaaaa-aaaa-1111-aaaa-xxxxxxxxxxxxx/",
        "behaviour": OIDC_DEFAULT_BEHAVIOUR,
        "client_registration": {
            "client_id": "your_client_id",
            "client_secret": "your_client_secret",
            "redirect_uris": ["http://localhost:8000/openid/callback/login/"],
            "post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/"],
            "token_endpoint_auth_method": "client_secret_post",
        }
    }
}You may now test the authentication by going to (on the development server)http://localhost:8000/openid/loginor to any
of your views that requires authentication.FeaturesReady to use Django authentication backendNo models stored in database - just some configuration in settings.py to keep it simpleFully integrated with Django’s internal accounts and permission systemSupport for all OIDC workflows: Authorization Code flow, Implicit flow, Hybrid flow. Don’t worry if you don’t know
what these are - the package comes with great defaults.Includes logout at the provider levelHistory0.1.4 (2017-01-07)OIDC library was updated. Its version is no longer “latest” to avoid breaking django-oidc on each major library update.code that was broken by the update was fixed.no more need for wheels on Windows.0.1.0 (2015-05-08)First release
Package: django-oidc-client
About OpenIDOpenID Connect is a simple identity layer on top of the OAuth 2.0 protocol, which allows computing clients to verify the identity of an end-user based on the authentication performed by an authorization server, as well as to obtain basic profile information about the end-user in an interoperable and REST-like manner.Googleis a good example of an OpenID Provider.About the packageEmpty.ContributingWe love contributions, so please feel free to fix bugs, improve things, provide documentation. Just submit a Pull Request.
Package: django-oidc-rp
Django-oidc-rpis a lightweight - server side OpenID Connect Relying Party (RP/Client)
implementation for Django. It allows to easily integrate an OpenID Connect provider as the
authentication source in a Django project.Table of ContentsDocumentationMain requirementsAuthorsLicenseDocumentationOnline browsable documentation is available athttps://django-oidc-rp.readthedocs.io.Head over to the documentation for all the details on how to add OpenID Connect authentication
support to your Django projectMain requirementsPython 3.4+, Django 1.11+.Authorsimpak Finance <tech@impakfinance.com>.LicenseMIT. SeeLICENSEfor more details.
Package: django-oidc-sub
# django-oidc-sub[![Build Status](https://travis-ci.org/tpazderka/django-oidc-sub.svg?branch=master)](https://travis-ci.org/tpazderka/django-oidc-sub)
[![codecov](https://codecov.io/gh/tpazderka/django-oidc-sub/branch/master/graph/badge.svg)](https://codecov.io/gh/tpazderka/django-oidc-sub)> Django application for login through OpenID ConnectThis library provides a database model for connection betweenAUTH_USER_MODELandsubclaim received from provider.
It also provides an authentication backend that returns appropriate User based on the receivedsubclaim.## Table of Contents
- [Dependencies](#dependencies)
- [Configuration](#configuration)
- [Testint](#testing)
- [License](#license)## DependenciesDjango >=1.11mozilla-django-oidc## ConfigurationAdddjango_oidc_subandmozilla_django_oidcto your installed apps.Adddjango_oidc_sub.backends.OidcSubBackendto yourAUTHENTICATION_BACKENDS.## Testingtox## LicenseSee [LICENSE](LICENSE)
Package: django-oidc-tf
This module makes it easy to integrate OpenID Connect as an authentication source in a Django project.Behind the scenes, it uses Roland Hedberg’s great pyoidc library.Modified by JHUAPL BOSS to support Python3Modified by Thomas Frössman with fixes and additional modifications.QuickstartInstall djangooidc:# Latest (pre) release
pip install django-oidc-tf


# Latest code - unstable!
pip install git+https://github.com/thomasf/django-oidc.gitThen to use it in a Django project, add this to your urls.py:url(r'openid/', include('djangooidc.urls')),Then add the following items to your settings.py:add‘djangooidc.backends.OpenIdConnectBackend’to AUTHENTICATION_BACKENDSafterthe default‘django.contrib.auth.backends.ModelBackend’set LOGIN_URL = ‘openid’add the specific OIDC parameters (change the absolute URLs to yours):# Information used when registering the client, this may be the same for all OPs
# Ignored if auto registration is not used.
OIDC_DYNAMIC_CLIENT_REGISTRATION_DATA = {
    "application_type": "web",
    "contacts": ["ops@example.com"],
    "redirect_uris": ["http://localhost:8000/openid/callback/login/", ],
    "post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/", ]
}

# Default is using the 'code' workflow, which requires direct connectivity from your website to the OP.
OIDC_DEFAULT_BEHAVIOUR = {
    "response_type": "code",
    "scope": ["openid", "profile", "email", "address", "phone"],
}The configuration above is enough to use OIDC providers (OP) that support discovery and self client registration.
In addition, you may want to use a specific OpenID Connect provider that is not auto-discoverable. This is done
by adding items to the OIDC_PROVIDERS dictionary. See full documentation for parameter names.For example, an Azure AD OP would be:OIDC_PROVIDERS = {
    "Azure Active Directory": {
        "srv_discovery_url": "https://sts.windows.net/aaaaaaaa-aaaa-1111-aaaa-xxxxxxxxxxxxx/",
        "behaviour": OIDC_DEFAULT_BEHAVIOUR,
        "client_registration": {
            "client_id": "your_client_id",
            "client_secret": "your_client_secret",
            "redirect_uris": ["http://localhost:8000/openid/callback/login/"],
            "post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/"],
        }
    }
}You may now test the authentication by going to (on the development server)http://localhost:8000/openid/loginor to any
of your views that requires authentication.FeaturesReady to use Django authentication backendNo models stored in database - just some configuration in settings.py to keep it simpleFully integrated with Django’s internal accounts and permission systemSupport for all OIDC workflows: Authorization Code flow, Implicit flow, Hybrid flow. Don’t worry if you don’t know
what these are - the package comes with great defaults.Includes logout at the provider levelHistory0.1.0 (2015-05-08)First release
Package: django-oidc-user
Django OpenID Connect UserAn extended User model that is designed to have the majority of the attributes of what the OpenID Connect specification mentions.How to installInstallation can be done with a single command:$ pip install django-oidc-userHow to useSetup in your project is easy. Just add it to your installed apps:INSTALLED_APPS=[...'django_oidc_user',]And you will need to set it as your default User model, so add the following line to your settings:AUTH_USER_MODEL='django_oidc_user.User'After you have done this make sure yourun migrationsusing the following command:$ python manage.py migrate django_oidc_userYou can import the model to use in your views like so:fromdjango_oidc_user.modelsimportUser
Package: django-ok-17track
django-17track is an unofficial 17track.com API wrapper for Django.InstallationInstall with pip:$pipinstalldjango-ok-17trackUpdate INSTALLED_APPS:INSTALLED_APPS=[...'track17',...]Make migrations$pythonmanage.pymigrateAvailable settingsTRACK17_API_KEY- API key for service.TRACK17_API_KEY_FUNCTION- Custom function to return API key, if you want to store it outside the Django settings.TRACK17_COUNTRIES_URL- Url to grab countries. Useshttps://www.17track.net/en/apicountry.TRACK17_CARRIERS_URL- Url to grab carriers. Useshttps://www.17track.net/en/apicarrier.Basic example to use:How to get all countries and carriers:pythonmanaget.pypopulate_carriersHow to register tracking number and get it’s info:fromrest_frameworkimportserializersfromtrack17.servicesimportregister_track,get_track_info,get_track_info_as_packagesfromapps.track17.exceptionsimportDateProcessingError# try to register tracking number at 17track APItry:register_track('tracking_number')exceptDateProcessingErrorasexc:raiseserializers.ValidationError(str(exc))# try to fetch an actual info about a tracking numbertry:response:Dict=get_track_info('tracking_number')exceptDateProcessingErrorasexc:raiseserializers.ValidationError(str(exc))accepted_packages=response.get('accepted',[])# return packages info as a list of `PackageEntity` (dataclass instance) objects# in a readable way with a represantion of carriers and countries as Django model instancespackages=get_track_info_as_packages(accepted)Or can use 17track adapter directly:fromtrack17.track17importTrack17Adaptertrack17=Track17Adapter()response=track17.register('number1','number2')response=track17.get_track_info('number1','number2')
Package: django-ok-language-tools
Some language tools for Django.InstallationInstall with pip:$pipinstalldjango-ok-language-toolsUpdate INSTALLED_APPS:INSTALLED_APPS=[...'ok_language_tools',...]Available settingsLANGUAGE_TOOLS_REDIRECT_TO_QUERY_PARAMETER- Query parameter to get next url for ‘set_language’ view.LANGUAGE_TOOLS_LANGUAGE_QUERY_PARAMETER- Query parameter to get languge to translate next url for ‘set_language’ view.LANGUAGE_TOOLS_REDIRECT_EXCLUDE_PREFIXES- Tuple of prefixes to skip redirect for ‘language_redirect_middleware’.For example:LANGUAGE_TOOLS_REDIRECT_EXCLUDE_PREFIXES=('/api/v1/','/uploads/','/static/',)LANGUAGE_TOOLS_DEFAULT_REDIRECT_LANGUAGE- Language code to redirect for a first user visit.LANGUAGE_TOOLS_VISITED_SESSION_KEY- Key to store visited state in session.QuickstartAdd ‘language_redirect_middleware’ to the MIDDLEWARE configuration to redirect users to default language during a first visit:MIDDLEWARE=[...'ok_language_tools.middleware.language_redirect_middleware']To enable ‘set_language’ view, add next URL patterns:urlpatterns=[...path('',include('ok_language_tools.urls')),]language_url=reverse('ok-language-tools:set-language')catalog_url='/catalog/'language='uk'set_language_url=f'{language_url}?redirect_to={catalog_url}&language={language}'# or using HTTP_REFERERset_language_url=f'{language_url}?language={language}'
Package: django-ok-likes
django-ok-likesis a liking app for Django, which allows users “like” and “unlike” any model instance. All functionality provides throughdjango-rest-frameworkAPI views. Template tags and jinja’s global functions provide the ability to see who liked an object, which objects were liked by current user and count of likes for a given object.InstallationInstall with pip:pipinstalldjango-ok-likesUpdate INSTALLED_APPS:INSTALLED_APPS=[...'likes','rest_framework',...]Make migrations:pythonmanage.pymigrateAddlikes.api.urlsto your project urlpatterns:urlpatterns=[...path('api/v1/',include('likes.api.urls')),...]Available settingsAdd the models that you want to like to LIKES_MODELS in your settings file:LIKES_MODELS={"app.Model":{'serializer':'app.api.serializer.YourModelSerializer'},}You can set any pagination class for ListAPIView:LIKES_REST_PAGINATION_CLASS='core.api.pagination.MyResponsePagination'UsageAPIBase endpoints/api/v1/likes/list/- List API View to return all likes for authenticated user.You can setserializerfor each model inLIKES_MODELSsetting to use it for content object serialization, otherwise, you will get an id of content object.For example:LIKE_MODELS={"article.Article":{'serializer':'article.api.serializers.ArticleSerializer'},}UseGETparametersearchto filter by a content type’s model:/api/v1/likes/list/?search=article/api/v1/likes/count/- API View to return count of likes for authenticated user./api/v1/likes/is/- API View to check is given elements are liked by authenticated user. As result, you will get a list ofids.Possible payload:{"type":'app_label.model',#'.'.join(object_ct.natural_key())"ids":[1,2,3]}Possible result:{"ids":[1,3]}/api/v1/likes/toggle/- API View to like-unlike a given object by authenticated user.Possible payload:{"type":'app_label.model',#'.'.join(object_ct.natural_key())"id":1}Possible result:{"is_liked":true}Filterslikes_countReturns a count of likes for a given object:{{object|likes_count}}Template Tagswho_likedReturns a queryset of users, who liked a given object:{%who_likedobjectasfans%}{%foruserinfans%}<div class="like">{{user.get_full_name}}likes{{object}}</div>{%endfor%}likesReturns a queryset of likes for a given user:{%likesrequest.userasuser_likes%}{%forlikeinuser_likes%}<div>{{like}}</div>{%endfor%}is_likedReturns a bool value, which says is a given object liked by a given user:{%is_likedobjectrequest.userasliked%}Jinja global functionsget_likes_countThe same as thelikes_countfilter.Usage:{{get_likes_count(object)}}get_who_likedThe same as thewho_likedtag.Usage:{{get_who_liked(object)}}get_likesThe same as thelikestag.Usage:{{get_likes(request.user)}}get_is_likedThe same as theis_likedtag.Usage:{{get_is_liked(object,request.user)}}Signalslikes.signals.object_likedA signal, which sents immediately after the object was liked and provides the single kwarg of createdLikeinstance.likes.signals.object_unlikedA signal, which sents immediately after the object was unliked and provides the single kwarg of an object.
Package: django-ok-payparts
Simple django integration for API “Оплата Частями в Интернете”:Схема взаимодействия №1 (Создание платежа по сервису Оплата частями/Мгновенная рассрочка).InstallationInstall with pip:$pipinstalldjango-ok-paypartsUpdate INSTALLED_APPS:INSTALLED_APPS=[...'payparts',...]Addpayparts.urlsto your project urlpatterns:urlpatterns=[...path('',include('payparts.urls')),...]Make migrations:$pythonmanage.pymigrateAvailable settingsPAYPARTS_API_PASSWORD- Password of your store.PAYPARTS_API_STORE_ID- Your store’s ID.PAYPARTS_API_URL- Url for creation of a payment. By default:https://payparts2.privatbank.ua/ipp/v2/.PAYPARTS_API_REDIRECT_URL- Url to redirect after a success payment. By default:https://payparts2.privatbank.ua/ipp/v2/payment.UsageHow to create a paymentPrepare your order’s data:data={"order_id":f"order-123","amount":400.00,"parts_count":2,# optional, default value is '2'"merchant_type":"II",# optional, default value is 'II'"products":[{"name":"Телевизор","count":2,"price":100.00},{"name":"Микроволновка","count":1,"price":200.00}],# also optional fields (can be set in your cabinet):"response_url":"http://shop.com/response","redirect_url":"http://shop.com/redirect",}Get your redirect url:frompayparts.use_casesimportGetRedirectUrlUseCaseredirect_url=GetRedirectUrlUseCase().execute(data)Redirect a user to the url.How to process a callbackWhenever a callback is processed a signal will be sent with the result of the transaction.There are two signals (payparts.signals):pay_parts_success_callback- if signature is valid.pay_parts_invalid_callback- if signature is not valid.Connect the signals to actions to perform the needed operations when a successful payment is received:frompayparts.signalsimportpay_parts_success_callback,pay_parts_invalid_callbackfromorders.modelsimportOrderdefsuccess_callback(sender,log,request,**kwargs):# ensure success stateiflog.is_success:order=Order.objects.get(pk=log.order_id)order.set_success_payment_state()pay_parts_success_callback.connect(success_callback)