Saravanan666/pypi-org huggingface dataset:
Package: django-graphql-jwt-reload
JSON Web Tokenauthentication forDjango GraphQLInstallationInstall last stable version from Pypi:pip install django-graphql-jwtAddAuthenticationMiddlewaremiddleware to yourMIDDLEWAREsettings:MIDDLEWARE=[...'django.contrib.auth.middleware.AuthenticationMiddleware',...]AddJSONWebTokenMiddlewaremiddleware to yourGRAPHENEsettings:GRAPHENE={'SCHEMA':'mysite.myschema.schema','MIDDLEWARE':['graphql_jwt.middleware.JSONWebTokenMiddleware',],}AddJSONWebTokenBackendbackend to yourAUTHENTICATION_BACKENDS:AUTHENTICATION_BACKENDS=['graphql_jwt.backends.JSONWebTokenBackend','django.contrib.auth.backends.ModelBackend',]SchemaAdddjango-graphql-jwtmutations to the root schema:importgrapheneimportgraphql_jwtclassMutation(graphene.ObjectType):token_auth=graphql_jwt.ObtainJSONWebToken.Field()verify_token=graphql_jwt.Verify.Field()refresh_token=graphql_jwt.Refresh.Field()schema=graphene.Schema(mutation=Mutation)DocumentationFantastic documentation is available athttps://django-graphql-jwt.domake.io.
Package: django-graphql-oauth2
django-graphql-oauth2is a Django application that provides
customizable OAuth2-authentication for your Django projects.
porteddjango-oauth2from rest to graphql inspired bydjango-graphql-jwtInstallationpip install django-graphql-oauth2Licensedjango-graphql-oauth2is a fork ofdjango-oauth2which is released under the MIT License. Please see the LICENSE file for details.
Package: django-graphql-ratelimit
Eaiser to usedjango-ratelimitfor graphql in django.Installpip install django-graphql-ratelimitUsageratelimit key supportgql:xxx, wherexxxis argument.fromdjango_graphql_ratelimitimportratelimitclassRequestSMSCode(graphene.Mutation):classArguments:phone=graphene.String(required=True)ok=graphene.Boolean()@ratelimit(key="ip",rate="10/m",block=True)@ratelimit(key="gql:phone",rate="5/m",block=True)defmutate(self,info,phone):request=info.context# send sms code logicreturnRequestSMSCode(ok=True)You can usedjango-ratelimit keysexceptget:xxxandpost:xxx:ip- Use the request IP address (i.e.request.META['REMOTE_ADDR'])
I suggest you to usedjango-ipwareto get client ip, modify yourMIDDLEWAREin settings:MIDDLEWARE = [
"django_graphql_ratelimit.middleware.ParseClientIpMiddleware",
...
]header:x-x- Use the value of request.META.get('HTTP_X_X', '').user- Use an appropriate value from request.user. Do not use with unauthenticated users.user_or_ip- Use an appropriate value fromrequest.userif the user is authenticated, otherwise userequest.META['REMOTE_ADDR'].
Package: django-graphql-social-auth
Python Social Authsupport forDjango GraphQLDependenciesPython ≥ 3.4Django ≥ 1.11InstallationInstall last stable version from Pypi.pipinstalldjango-graphql-social-authSee thedocumentationfor further guidance on settingPython Social Auth.Add theSocialAuthmutation to your GraphQL schema.importgrapheneimportgraphql_social_authclassMutations(graphene.ObjectType):social_auth=graphql_social_auth.SocialAuth.Field()Sessionauthentication viaaccessToken.provider: provider name fromAuthentication backend list.accessToken: third-party (Google, Facebook…) OAuth token obtained with any OAuth client.mutation SocialAuth($provider: String!, $accessToken: String!) {
  socialAuth(provider: $provider, accessToken: $accessToken) {
    social {
      uid
      extraData
    }
  }
}JSON Web Token (JWT)Authentication solution based onJSON Web Token.Install additional requirements.pipinstall'django-graphql-social-auth[jwt]'Add theSocialAuthJWTmutation to your GraphQL schema.importgrapheneimportgraphql_social_authclassMutations(graphene.ObjectType):social_auth=graphql_social_auth.SocialAuthJWT.Field()Authenticate viaaccessTokento obtain a JSON Web Token.mutation SocialAuth($provider: String!, $accessToken: String!) {
  socialAuth(provider: $provider, accessToken: $accessToken) {
    social {
      uid
    }
    token
  }
}RelayComplete support forRelay.importgrapheneimportgraphql_social_authclassMutations(graphene.ObjectType):social_auth=graphql_social_auth.relay.SocialAuth.Field()graphql_social_auth.relay.SocialAuthJWT.Field()forJSON Web Token (JWT)authentication.Relay mutationsonly accepts one argument namedinput:mutation SocialAuth($provider: String!, $accessToken: String!) {
  socialAuth(input:{provider: $provider, accessToken: $accessToken}) {
    social {
      uid
    }
  }
}CustomizingIf you want to customize theSocialAuthbehavior, you’ll need to customize theresolve()method on a subclass ofSocialAuthMutationor.relay.SocialAuthMutation.importgrapheneimportgraphql_social_authclassSocialAuth(graphql_social_auth.SocialAuthMutation):user=graphene.Field(UserType)@classmethoddefresolve(cls,root,info,social,**kwargs):returncls(user=social.user)Authenticate viaaccessTokento obtain theuser id.mutation SocialAuth($provider: String!, $accessToken: String!) {
  socialAuth(provider: $provider, accessToken: $accessToken) {
    social {
      uid
    }
    user {
      id
    }
  }
}Project templateThere is aDjango project templateto start a demo project.Gracias@omab/Python Social Auth.
Package: django-graphql-social-auth-d4
Python Social Authsupport forDjango GraphQLDependenciesPython ≥ 3.4Django ≥ 1.11InstallationInstall last stable version from Pypi.pipinstalldjango-graphql-social-authSee thedocumentationfor further guidance on settingPython Social Auth.Add theSocialAuthmutation to your GraphQL schema.importgrapheneimportgraphql_social_authclassMutations(graphene.ObjectType):social_auth=graphql_social_auth.SocialAuth.Field()Sessionauthentication viaaccessToken.provider: provider name fromAuthentication backend list.accessToken: third-party (Google, Facebook…) OAuth token obtained with any OAuth client.mutationSocialAuth($provider:String!,$accessToken:String!){socialAuth(provider:$provider,accessToken:$accessToken){social{uidextraData}}}JSON Web Token (JWT)Authentication solution based onJSON Web Token.Install additional requirements.pipinstall'django-graphql-social-auth[jwt]'Add theSocialAuthJWTmutation to your GraphQL schema.importgrapheneimportgraphql_social_authclassMutations(graphene.ObjectType):social_auth=graphql_social_auth.SocialAuthJWT.Field()Authenticate viaaccessTokento obtain a JSON Web Token.mutationSocialAuth($provider:String!,$accessToken:String!){socialAuth(provider:$provider,accessToken:$accessToken){social{uid}token}}RelayComplete support forRelay.importgrapheneimportgraphql_social_authclassMutations(graphene.ObjectType):social_auth=graphql_social_auth.relay.SocialAuth.Field()graphql_social_auth.relay.SocialAuthJWT.Field()forJSON Web Token (JWT)authentication.Relay mutationsonly accepts one argument namedinput:mutationSocialAuth($provider:String!,$accessToken:String!){socialAuth(input:{provider:$provider,accessToken:$accessToken}){social{uid}}}CustomizingIf you want to customize theSocialAuthbehavior, you’ll need to customize theresolve()method on a subclass ofSocialAuthMutationor.relay.SocialAuthMutation.importgrapheneimportgraphql_social_authclassSocialAuth(graphql_social_auth.SocialAuthMutation):user=graphene.Field(UserType)@classmethoddefresolve(cls,root,info,social,**kwargs):returncls(user=social.user)Authenticate viaaccessTokento obtain theuser id.mutationSocialAuth($provider:String!,$accessToken:String!){socialAuth(provider:$provider,accessToken:$accessToken){social{uid}user{id}}}Project templateThere is aDjango project templateto start a demo project.Gracias@omab/Python Social Auth.
Package: django-grappelli
A jazzy skin for the Django admin interface.Grappelli is a grid-based alternative/extension to theDjangoadministration interface.Codehttps://github.com/sehmaschine/django-grappelliWebsitehttp://www.grappelliproject.comDocumentationhttp://readthedocs.org/docs/django-grappelli/ReleasesGrappelli is always developed against the latest stable Django release and is NOT tested with Django’s master branch.Grappelli 3.0.8 (September 21st, 2023): Compatible with Django 4.0Grappelli 2.15.6 (November 22nd, 2022): Compatible with Django 3.2 (LTS)Current development branches:Grappelli 3.0.9 (Development version for Django 4.0, see branch Stable/3.0.x)Grappelli 2.15.7 (Development version for Django 3.2, see branch Stable/2.15.x)Older versions are available at GitHub, but are not supported anymore.
Package: django-grappelli-autocomplete-fk-edit-link
# Django Grappelli Autocomplete Foreign Key Edit Linkdjango-grappelli-autocomplete-fk-edit-link provides a `ModelAdmin` mixin that adds edit links to autocomplete lookups.Install using pip :sudo pip install git+https://github.com/CrossWaterBridge/django-grappelli-autocomplete-fk-edit-link.git@master#egg=django-grappelli-autocomplete-fk-edit-linkAdd `grappelli_autocomplete_fk_edit_link` to your `INSTALLED_APPS`:INSTALLED_APPS = (...'grappelli','grappelli_autocomplete_fk_edit_link',)Add the mixin to any `ModelAdmin` with one or more autocomplete foreign key lookup fields:from grappelli_autocomplete_fk_edit_link import AutocompleteEditLinkAdminMixinclass MyAdmin(AutocompleteEditLinkAdminMixin, admin.ModelAdmin):raw_id_fields = ['related_object']autocomplete_lookup_fields = {'fk': ['related_object'],}
Package: django-grappelli-captcha-admin
django-grappelli-captcha-adminEasy added captcha to Django administration login page. inherit from a-roomana/django-multi-captcha-adminDependencyTo use this module you need to install django and one of the captcha engines, which you can install it with easy_install or pip.InstallationInstall:pip install django-grappelli-captcha-adminif you are using python 2 then install version 1.0.0 (pip install django-multi-captcha-admin==1.0.0)Add'multi_captcha_admin'to yourINSTALLED_APPSsetting before'django.contrib.admin'app.INSTALLED_APPS=[...'captcha_admin','django.contrib.admin',...]CAPTCHA_CHALLENGE_FUNCT='captcha.helpers.math_challenge'CAPTCHA_TIMEOUT=1CAPTCHA_GET_FROM_POOL_TIMEOUT=0CAPTCHA_BACKGROUND_COLOR='#bbaaaa'EnginesWe support three famous engines to render CAPTCHA. You need to install one of them, then add it to your django project according to their documents.simple-captcharecaptcharecaptcha2For more information, please go to the engine site.Then add the following to yoursettings.pywith the name of the installed engine:MULTI_CAPTCHA_ADMIN={'engine':'simple-captcha',}Resultssimple captcharecaptcha2recaptcha
Package: django-grappelli-filters
Autocomplete filter for Grappelliv 0.2.1 (usable, but only if you know why)Filter for Foreign key and ManyToMany relations with AJAX autocomplete.
Reuses features from Grappelli, works nicely along other filters and
with both standard and sidebar filter template…InstallationPutgrappelli-filtersin yourPYTHONPATH.Add'grappelli-filters'toINSTALLED_APPSFiltersRelated Autocomplete FilterThis filter is similar to a regular foreign key field filter, with two
differences:it has a nice AJAX-powered autocomplete UI (straight from Grappelli)does not load all possible filter values in HTML - good for
situations with many of related objectsUsageConfigure Grappelli autocomplete feature as describedhere. Both
Model method andSETTINGSvalue will work fine. For the inpatient,
here is theSETTINGSvalue:GRAPPELLI_AUTOCOMPLETE_SEARCH_FIELDS = {
    "myapp": {
        "mycategory": ("id__iexact", "name__icontains",),
    }
}Inadmin.pyadd:from grappelli_filters import RelatedAutocompleteFilter, FiltersMixin

class MyModelAdmin(FiltersMixin, admin.ModelAdmin):
    list_filter = ( ... ('field_name', RelatedAutocompleteFilter), ... )Search FilterThis filter allows string searches over a single field. Several filters
combined provide better control over the resulting list then does the
built-in django-adminsearch_fieldsfeature.UsageIn admin.py add:from grappelli_filters SearchFilter

class MyModelAdmin(admin.ModelAdmin):
    list_filter = ( ... ('field_name', SearchFilter), ... )Case-sensitive Search FilterSimilar to Search Filter, but searches are case-sensitive.UsageUseSearchFilterCinstead ofSearchFilter
Package: django-grappelli-latest
A jazzy skin for the Django admin interface.Grappelli is a grid-based alternative/extension to theDjangoadministration interface.Codehttps://github.com/sehmaschine/django-grappelliWebsitehttp://www.grappelliproject.comDocumentationhttp://readthedocs.org/docs/django-grappelli/ReleasesGrappelli is always developed against the latest stable Django release and is NOT tested with Djangos trunk.Grappelli 2.8.1 (March 7th, 2016): Compatible with Django 1.9Grappelli 2.7.3 (January 11th, 2016): Compatible with Django 1.8Grappelli 2.6.5 (May 28th, 2015): Compatible with Django 1.7Current development branches:Grappelli 2.8.2 (Development version for Django 1.9, see branch Stable/2.8.x)Grappelli 2.7.4 (Development version for Django 1.8, see branch Stable/2.7.x)Grappelli 2.6.6 (Development version for Django 1.7, see branch Stable/2.6.x)Older versions are available at GitHub, but are not supported anymore.
Support for 2.6.x and 2.7.x is limited to security issues and very important bugfixes.
Package: django-gravatar2
A lightweight django-gravatar app. Includes helper methods for interacting with gravatars outside of template code.FeaturesHelper methods for constructing a gravatar url and checking an email for an existing gravatarTemplatetags for generating a gravatar url or gravatar <img> tag.Full test suite!InstallingInstall from PyPi:You can pip install the app directly from GitHub:$ pip install git+git://github.com/twaddington/django-gravatar.git#egg=DjangoGravatarAlternatively, you can now install directly from PyPi!$ pip install django-gravatar2Make sure you installdjango-gravatar2as
there are several other incompatible django-gravatar libraries available.Add django_gravatar to your INSTALLED_APPS in settings.py:INSTALLED_APPS = (
    # ...
    'django_gravatar',
)Basic UsageUse in code:from django_gravatar.helpers import get_gravatar_url, has_gravatar, get_gravatar_profile_url, calculate_gravatar_hash

url = get_gravatar_url('alice@example.com', size=150)
gravatar_exists = has_gravatar('bob@example.com')
profile_url = get_gravatar_profile_url('alice@example.com')
email_hash = calculate_gravatar_hash('alice@example.com')Use in templates:{% load gravatar %}

{% gravatar_url user.email 150 %}
# https://secure.gravatar.com/avatar/hash.jpg?size=150

{% gravatar user.email 150 %}
# <img class="gravatar" src="https://secure.gravatar.com/avatar/hash.jpg?size=150" width="150" height="150" alt="" />

{% gravatar user.email 150 "user@example.com" %}
# <img class="gravatar" src="https://secure.gravatar.com/avatar/hash.jpg?size=150" width="150" height="150" alt="user@example.com" />

{% gravatar_profile_url user.email %}
# https://secure.gravatar.com/hashConfiguringThe following options can be configured in your settings.py:GRAVATAR_URL            # Gravatar base url. Defaults to ‘http://www.gravatar.com/’GRAVATAR_SECURE_URL     # Gravatar base secure https url. Defaults to ‘https://secure.gravatar.com/’GRAVATAR_DEFAULT_SIZE   # Gravatar size in pixels. Defaults to ‘80’GRAVATAR_DEFAULT_IMAGE  # An image url or one of the following: ‘mm’, ‘identicon’, ‘monsterid’, ‘wavatar’, ‘retro’. Defaults to ‘mm’GRAVATAR_DEFAULT_RATING # One of the following: ‘g’, ‘pg’, ‘r’, ‘x’. Defaults to ‘g’GRAVATAR_DEFAULT_SECURE # True to use https by default, False for plain http. Defaults to TrueContributingFeel free tofork django-gravataron GitHub! We’d love to see your pull requests. Please make sure you run
tests before submitting a patch.Run tests:$> cd example_project
$> ./manage.py test django_gravatar
Package: django-gravy
Gravy is a set of useful extensions to Django that I found myself reusing.RequirementsTo enable all features of gravy you will need to install the following python packages:django-betterforms => gravy.formsdjango-widget-tweaks => gravy/templates/gravy/form_snippet.htmldjango-redis => gravy.websocketgevent-websocket => gravy.websocketjsonschema => gravy.formsbeautifulsoup4 => gravy.templatetags.gravytags ({% staticonce %} and {% prettyhtml %})python-magic => gravy.utilspillow => gravy.imagespytesseract => gravy.imagesgeoip2 => gravy.geo.geoip2Additional dependencies (aptitude):python-pipredis-server => django-redislibgeoip1 => django (for django.contrib.gis.geoip used by gravy.geo.geoip)libjpeg-dev => pillowlibpng12-dev => pillowtesseract-ocr => pytesseractliblzo2-2 => gravy.lzolibmaxminddb0 => geoip2libmaxminddb-dev => geoip2mmdb-bin => geoip2If you are using geoip or geoip2 then you will also databases from maxmind.InstallationA complete install goes something like this. You’re install might be a bit different (virtualenv etc)sudo apt-get install python-pip redis-server libgeoip1 libjpeg-dev libpng12-dev tesseract-ocr liblzo2-2 libmaxminddb0 libmaxminddb-dev mmdb-bin
sudo pip install django-widget-tweaks django-redis gevent-websocket jsonschema beautifulsoup4 pillow pytesseract geoip2
sudo pip install django-gravyFeaturesMany … Until I get time to update this check the source code.
Package: django-gravy-bitfield
Provides a BitField like class (using a BigIntegerField) for your Django models.(If you’re upgrading from a version before 1.2 the API has changed greatly and is backwards incompatible!)RequirementsDjango >= 1.10PostgreSQL (see notes)Notes:SQLite does not support save operations using aBit(per the example under Usage).MySQL fails on most queries related to BitField’s.InstallationInstall it with pip (or easy_install):pip install django-bitfieldUsageFirst you’ll need to attach a BitField to your class. This acts as a BigIntegerField (BIGINT) in your database:from bitfield import BitField

class MyModel(models.Model):
    flags = BitField(flags=(
        'awesome_flag',
        'flaggy_foo',
        'baz_bar',
    ))Flags can also be defined with labels:class MyModel(models.Model):
    flags = BitField(flags=(
        ('awesome_flag', 'Awesome Flag!'),
        ('flaggy_foo', 'Flaggy Foo'),
        ('baz_bar', 'Baz (bar)'),
    ))Now you can use the field using very familiar Django operations:# Create the model
o = MyModel.objects.create(flags=0)

# Add awesome_flag (does not work in SQLite)
MyModel.objects.filter(pk=o.pk).update(flags=F('flags').bitor(MyModel.flags.awesome_flag))

# Set flags manually to [awesome_flag, flaggy_foo]
MyModel.objects.filter(pk=o.pk).update(flags=MyModel.flags.awesome_flag | MyModel.flags.flaggy_foo)

# Remove awesome_flag (does not work in SQLite)
MyModel.objects.filter(pk=o.pk).update(flags=F('flags').bitand(~MyModel.flags.awesome_flag))

# Find by awesome_flag
MyModel.objects.filter(flags=MyModel.flags.awesome_flag)

# Exclude by awesome_flag
MyModel.objects.filter(flags=~MyModel.flags.awesome_flag)

# Test awesome_flag
if o.flags.awesome_flag:
    print "Happy times!"

# List all flags on the field
for f in o.flags:
    print f

# Get a flag label
print o.flags.get_label('awesome_flag')Enjoy!AdminTo use the widget in the admin, you’ll need to update your ModelAdmin. Add the
following lines to your ModelAdmin:formfield_overrides = {
        BitField: {'widget': BitFieldCheckboxSelectMultiple},
}Make sure you’ve imported the classes by adding these lines to the top of the file:from bitfield import BitField
from bitfield.forms import BitFieldCheckboxSelectMultipleThere is also aBitFieldListFilterlist filter (Django 1.4 or newer).
To use it setlist_filterModelAdmin option:list_filter = (
        ('flags', BitFieldListFilter,)
        )BitFieldListFilter is inbitfield.adminmodule:from bitfield.admin import BitFieldListFilter
Package: django-greekapp
This is a reusable Django application that allows you to interact with the text of the
New Testament in its original language. This is intended for students of Koine
Greek.Hovering over a Greek word will reveal its meaning and its grammatical
information (gender, tense, mood, person, etc.).There’s no accounts, nothing like that. It’s using Redis as the backend because
it’s blazing fast and very memory efficient.All of the text, grammar, lexical data and so is in the public domain.Installation$ pip installdjango-greekappAddgreekapptoINSTALLED_APPSPlug GreekApp to your project’surls.py.Make sure Redis is installed and runningRun theloadmanagement command to load data into RedisRun the server.ProfitLicenseBSD, short and sweet.
Package: django-green-grove
Collection of helpers to back up Django projects that use a Postgres database and a S3 bucket as media storage.QuickstartInstall django-green-grove using pip:pip install django-green-groveAdd the following to yoursettings.pymodule:BACKUP_BUCKET_AWS_ACCESS_KEY_ID = ''
BACKUP_BUCKET_AWS_SECRET_ACCESS_KEY = '
BACKUP_BUCKET_BUCKET_NAME = ''
BACKUP_BUCKET_LOCATION = ''Backup ProjectWe suggest to use this management command as a cron tab:python manage.py backup_projectTutorialThis tutorial covers the steps that are needed to backup and restore a Django project that uses a Dokku hosting with a Postgres database and a S3 Bucket as media storage.Backup projectConnect to your serverConnect to the docker container:dokku enter <project_name>python manage.py backup_projectRestore from backupConnect to your serverConnect to the database:dokku postgres:connect dbDrop the database:DROP DATABASE <db_name>;Recreate the database:CREATE DATABASE <db_name>;Grant privileges:GRANT ALL PRIVILEGES ON DATABASE <db_name> to <username>;Exit the postgres console and the session on the serverDownload the database dump file from the bucket to your local machine:s3cmd cp <path_of_dump_file> .Move the dump file to the server:scp <path_of_dump_file> <server>Connect to your serverImport the dump:cat <file_name> | sudo docker exec-idokku.postgres.db psql-U<username> <db_name>Remove the media folder of your bucket (s3cmd or web interface)Open up the terminal on your local machineCopy the backup of the media folder back to the bucket:s3cmd cp--recursive--acl-publics3://backups/<project_name>/<timestamp>/media/s3://<project_name>/media/TriviaThis package is named after the fictional retirement community where Tony Soprano, Paulie Gualtieri, and other Mafiosi admit their mothers, in The Sopranos.CreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory
Package: django-green-migration
django-green-migrationsWhile the server is running,
if you deploy a new version which contains a migration that drop a field, it will make your production down.
This is because the migration will be executed before the new code is deployed.
This package will help you to avoid this problem.Normal deploymentDeploy new code to serverKeep server runningRun migrationsSwitch to new codeDestroy old codeAt step 3, if the migration contains a field drop, the server will be down.Green deploymentDeploy new code to serverKeep server runningRun green migrationpython manage.py green_migrate > output.jsonRun migrationsSwitch to new codeDestroy old codeRun pos green migrationpython manage.py pos_green_migrate output.jsonAt step 3, it will modifydropmigration tonullable and blankablemigration, this will help both old and new code to work.At step 7, it will read the output from step 3 to drop fields, this will help to clean up the database.InstallationInstall packagepip install django-green-migrationAddgreen_migrationtoINSTALLED_APPSSetup deployment like above explanation (make sure don't commit changes at step 3 to git)