Saravanan666/pypi-org huggingface dataset:
Package: django-grep-db
django_grepdb is a simple command-line app to provide basic grep-like searching of
Django model fields using the ORM. Written to facilitate searching for a tag,
filter, named url etc in templates in the database, but can also be used to quickly
find model instances from the command line.Quick startAdd “django_grepdb” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'django_grepdb',
)or, if you have a separate settings file for development in which you
extend your global settings, like this:INSTALLED_APPS = INSTALLED_APPS + ('django_grepdb',)Run:$ python manage.py grepdb <pattern> <app_label.Model.field_name>UsageFind instances of{%custom_template_tag.*%}in all text fields on the
modelEmailActionfrom appsprinkle, show lines containing matches,
and generate admin links (ifdjango.contrib.adminis installed):$ python manage.py grepdb "{% custom_template_tag.*%}" sprinkle.EmailAction
<class 'sprinkle.models.EmailAction'> text_field

User registered (pk=13)
localhost:8000/admin/sprinkle/emailaction/13/
<p>Hi {% custom_template_tag user.get_full_name %},</p>

Password reset request (pk=24)
localhost:8000/admin/sprinkle/emailaction/24/
<p>Hi, {% custom_template_tag user.get_full_name %}</p>OptionsOptions are listed using$ python manage.py grepdb--helpbut here are some of the things
you can do withdjango_grepdb.Search multiple models:$ python manage.py grepdb <pattern> sprinkle.EmailAction cms.MarkdownNodeSpecify fields instead of finding all text fields:$ python manage.py grepdb <pattern> sprinkle.EmailAction.body sprinkle.EmailAction.subjectFind all instances of CharField instead of TextField:$ python manage.py grepdb <pattern> sprinkle.EmailAction -cShow the whole field of a match rather than just the line:$ python manage.py grepdb <pattern> sprinkle.EmailAction -saChange the hostname of the admin links:$ python manage.py grepdb <pattern> sprinkle.EmailAction -l https://dev.example.comSpecify hostname key-value pairs in settings:DJANGO_GREPDB_SITES = {
    'default': 'https://staging.example.com'
    'dev': 'https://dev.example.com',
}

$ python manage.py grepdb <pattern> sprinkle.EmailAction -l devSpecify preset configurations in settings:DJANGO_GREPDB_PRESETS = {
    'users': dict(identifiers=['auth.user', 'projects.userprofile'],
                  field_type=['CharField', 'TextField'],
                  ignore_case=True),
    'templates': dict(identifiers=['sprinkle.EmailAction', 'cms.HTMLNode', 'cms.TextNode', 'cms.MarkdownNode'])

$ python manage.py grepdb <pattern> -p templates
Package: django-gridfs-storage
django-gridfs-storageSimple django GridFS storage engineUsage:Installdjango_gridfs_storage:pip install django_gridfs_storageInto settings.py file of your project, addgridfs_storagetoINSTALLED_APPS:INSTALLED_APPS=[...,'gridfs_storage',]add the following variables to your settings:# defaults to default local mongodb serverDEFAULT_GRIDFS_URL='mongodb://127.0.0.1:27017'# if set to None, it will refuse to serve files and raise an ExceptionDEFAULT_GRIDFS_SERVE_URL=NoneDEFAULT_GRIDFS_COLLECTION='storage'To serve files through django (not recommended) you can use this in urls.py:urlpatterns=[path('admin/',admin.site.urls),...,path('media/',include('gridfs_storage.urls')),]and set theDEFAULT_GRIDFS_SERVE_URLto the prefix you specified in the path. in this case its/media/If you wish to use it on allFileFieldandImageFieldset it as the default Storage:DEFAULT_FILE_STORAGE='gridfs_storage.storage.GridFSStorage'If you wish to use on individual field bases set it as the field storage:fromdjango.dbimportmodelsfromgridfs_storage.storageimportGridFSStorageclassSampleModel(models.Model):attachment=models.FileField(storage=GridFSStorage())first_pic=models.ImageField(storage=GridFSStorage(location='sample/images'))# To store in a different collection than "storage"another_pic=models.ImageField(storage=GridFSStorage(collection='image_storage'))# Serve through custom cdn connected to the same gridfs or similar, the limit is the sky :)served_outside=models.ImageField(storage=GridFSStorage(base_url='https://img.cdn/serve/'))Requirements:Python 3.6 or higher.Django 2.2 or higher.MongoDB 3.4 or higher.Tests? None.We crash production like real men
Package: django-groot
Django GrootAn alternative admin interface for managing group permissions withdjango-guardian. Groot requires django-guardian for maintaining permissions,
however Groot only focuses on groups for object permissions - per user object
level permissions aren’t allowed for simplicity.InstallationUsingpip:$pipinstalldjango-grootFollow the instructions for installingdjango-guardianif you haven’t
already.Edit your Django project’s settings module, and addgroot:INSTALLED_APPS=[# ...'groot',]UsageAddGrootAdminMixinto the admin class you want Groot to be used on:fromdjango.contribimportadminfromgroot.adminimportGrootAdminMixinfrom.modelsimportPost@admin.register(Post)classPostAdmin(GrootAdminMixin,admin.ModelAdmin):passTo limit the permissions which can be edited, add agroot_permissionsattribute:classPostAdmin(GrootAdminMixin,admin.ModelAdmin):groot_permissions=('change_post','delete_post')
Package: django-groove
# Django Groovedjango-groove is a Django app with various utilities, such as a templatecontext processor that adds the current Django Site object and an utilitymethod for sending HTML mail.## InstallationInstall `django-groove` (available on PyPi):pip install django-groove## Components### `groove.auth.decorators`Two decorators that limits a view with Django User permissions, includes checksfor staff or super users. Raises a 404 if user does not have sufficientpermission, security through obscurity.Available decorators: `staff_required` and `superuser_required`.Example usage in views:@superuser_requireddef index(request):...Example usage in URL config:url(r'^$', superuser_required('views.index'), name='index'),### `groove.context_processors.site.current_site`A template context processor that adds the current Django Site object to thetemplate context. Uses `RequestSite` as fallback.Add this to your settings.py:from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORSTEMPLATE_CONTEXT_PROCESSORS += ('groove.context_processors.site.current_site',)You can now use `{{ site.name }}` and `{{ site.domain }}` in all your templates.### `groove.email.html.send_html_email`A shortcut to ease sending of HTML enabled email. Adds current site, media andstatic URLs to template context, if not present.Usage:from groove.email.html import send_html_emailemail_sent = send_html_email('foo@example.com', 'account/welcome', {'user': user})With `template_prefix` as `'account/welcome'`, the following templatesare rendered with `user` variable available:* account/welcome.txt (plain text version)* account/welcome.html (HTML version)* account/welcome_subject.txt (plain text subject, one line only)### `groove.http.JsonResponse`An HTTP response class with JSON mime type, optionally dumps given objectto JSON. Also converts datetime and Decimal objects properly.### `groove.models.abstract.TimestampedModel`Abstract Django class that automatically timestamps object instances uponcreation and modification.Inherit from `TimestampedModel` instead of `models.Model` to automatically add`creation_time` and `modification_time` fields to model.### `groove.storage.s3`Defines two `s3boto` storage classes to ease the separation of static andmedia files when using Amazon S3.### `groove.views.generic.LimitedTemplateView`Wrapper around TemplateView generic view with a login required decorator.Example usage in URL config:url(r'^secret/$', LimitedTemplateView.as_view(template_name='secret.html'), name='secret'),### `groove.views.generic.ExtraContextTemplateView`Extends TemplateView to accept a dictionary of additional context.Example usage in URL config:url(r'^foo/$', ExtraContextTemplateView.as_view(template_name='foo.html', extra_context={'foo': 'bar'})),
Package: django-groupadmin-users
Edit users in group from the Group add and edit pages.Credit goes to thisStack Overflow
answerInstallationWorks with Django version 1.8 to 3.1.Tested with Django-supported Python versions.Install with:pip install django-groupadmin-usersUsageAdd ‘’groupadmin_users’’ to INSTALLED_APPS after
‘’django.contrib.auth’’. That’s it.Alternatively, don’t add ‘’groupadmin_users’’ to INSTALLED_APPS, but
use and further customize this code:fromdjango.contribimportadminfromdjango.contrib.auth.modelsimportGroupfromgroupadmin_users.formsimportGroupAdminForm# Unregister the original Group admin.admin.site.unregister(Group)# Create a new Group admin.classGroupAdmin(admin.ModelAdmin):# Use our custom form.form=GroupAdminForm# Filter permissions horizontal as well.filter_horizontal=['permissions']# Register the new Group ModelAdmin.admin.site.register(Group,GroupAdmin)DemoExample image from Stack Overflow answer:
Package: django-group-by
This package provides a mixin for Django QuerySets that adds a methodgroup_bythat
behaves mostly like thevaluesmethod, but with one difference: its iterator does not
return dictionaries, but amodel-like object with model instances for related values.InstallationInstall from PyPI:pip install django-group-byCompatibilityThis package is compatible with Django 1.8, 1.9 and 1.10, and Python versions 2.7, 3.4, 3.5 and 3.6.
Probably others, but those 12 combinations are the ones against which we build (by Travis CI).UsageCreate a QuerySet subclass with theGroupByMixinto use in a model’s manager:# models.py

from django.db import models
from django.db.models.query import QuerySet
from django_group_by import GroupByMixin

class BookQuerySet(QuerySet, GroupByMixin):
    pass

class Book(Model):
    objects = BookQuerySet.as_manager()

    title = models.CharField(max_length=100)
    author = models.ForeignKey('another_app.Author')
    publication_date = models.DateField()
...Then use it just likevalues, and you’ll get a similar query set:>>> some_rows = Book.objects.group_by('title', 'author', 'author__nationality').distinct()
>>> some_rows.count()
4The difference is that every row is not a dictionary but an AggregatedGroup instance, with only the grouped fields:>>> row = some_rows[0]
>>> row
<AggregatedGroup for Book>
>>> row.title
The Colour of Magic
>>> row.publication_date
*** AttributeError: 'AggregatedGroup' object has no attribute 'publication_date'But of course the main advantage is that you also get related model instances, as far as you want:>>> row.author
<Author: Terry Pratchett>
>>> row.author_nationality
<Nation: Great Britain>Related Model ID OnlyThe previous example shows a difference in behaviour from Django’svalues: we’re grouping by the foreign keyauthor, but instead of getting only the ID we get the full instance. Why? Because it’s more useful, and I
think that getting{‘author’: 5}as a result is just weird.If you just want the ID you can specify it:>>> some_rows = Book.objects.group_by('title', 'author_id', 'author__nationality_id').distinct()
Package: django-group-role
Django Group Roledjango-group-roleaims to simplify "role based access" in django-based projects and applications.
This app is build on top oncontrib.authandguardianapps.django-group-roleaims to enhance existingGroupandPermissionmodels ofcontrib.authapp to configure global-level access rules.InstallFirst add'django_group_role'toINSTALLED_APPSaftercontrib.authandguardianand then configure the "role-definition" module:INSTALLED_APPS=[..."django.contrib.auth",..."guardian","django_group_role",...]# every used role must be registered in this moduleROLES_MODULE="myproject.roles"Basic Setup"Roles" are classes derived fromdjango_group_role.roles.Roleand should declare the following two attributes:name: the name of the group which will be bound to this role (mandatory)permissions: specify which permissions are granted to this role, it may be indicated in one of the following form:alistof available permission which will be bound to this role, they must be provided using the notation'<appname>.<codename>'adictwhich keys can be app-names or<appname.model>(see example below)fromdjango_group_roleimportRoleclassBasicRole(Role):name="Base"abstract=Truepermissions=["auth.view_user","auth.view_group"]classExpandedRole(BasicRole):name="Expanded"permissions=["auth.add_user","auth.change_user"]classDerivedRole(BasicRole):name="Derived"permissions={'auth':{'user':['view_user','add_user','delete_user']},'auth.group':['view_group'],}NOTE: to do not have the command creating a "base" group set it asabstract = TrueRole inheritanceRoles can derive one-another like normal python classes, when a roles extend an other one it is not required to provide thepermissionslist. When extending an existing role its permissions gets merged with those defined in the base class.NOTE: ATM multi-role inheritance is not tested, it may work but it is not guaranteed.Database alignmentSinceRoleclasses are not bound to databaseGroupthey must be synchronized in order to work as expected. To perform this the management commandpopulate_rolesis available. This command takes every configured role defined inROLES_MODULEand set-up its permissions on the database, also creating the appropriate group if it does not exists yet.See command help for further information regarding its arguments.SignalsUpon setup each role fires two signals:pre_role_setup: before the setup process starts, providingroleandclearkwargspost_role_setup: after the setup process ends, providingrolekwargsUse in unittest (TestCase)For django styleTestCasebased testing is it possible to use theRoleEnabledTestMixin. This overrides thesetUpTestDatato load and create role-related data before running tests.NOTE: ATM it is not guaranteed that loading different roles in each test may not collide, it could be released in the future.CreditsThis work was in part inspired bydjango-role-permissions.
Package: django-groups2
CapabilitiesAdds aGroup2model to improve upon the django.auth.GroupAdds aGroup2Kindmodel to have group kindsAdds various needed properties toGroup2Adds a proper hierarchy usinghttps://github.com/django-treebeard/django-treebeard(editable through django-admin)Has an one-to-one relationship with builtinGroup(created automatically on save) which is used to keep user members and any needed permissionsAllows user membership to be edited through django-adminRequirementsThis works with Django 3+ and Python 3.6+. It will also installdjango-treebeard.InstallationRunpip installdjango-groups2Add"groups2"and"treebeard"to yourINSTALLED_APPSsetting.Changelogv.0.1.1Fix bug with not including templatesv.0.1.0Initial version
Package: django-groups-cache
Caches the groups a user is in so requests don’t have to make calls to the database to check group status.SupportCurrently supporting Django 1.8, 1.11, and 2.0 with Python 2.7/Python 3 where support for versions aligns with
Django’s support. See thetox.inifile for specific Python and Django version pairings.DocumentationThe full documentation is athttps://django-groups-cache.readthedocs.io.QuickstartInstall django-groups-cache:pip install django-groups-cacheAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'groups_cache.apps.GroupsCacheConfig',...)Add the middleware to yourMIDDLEWARE_CLASSES:MIDDLEWARE_CLASSES=('django.contrib.sessions.middleware.SessionMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware',...'groups_cache.middleware.GroupsCacheMiddleware',)Checking in a Django Template if the user is in a group name:{%if"admins"inrequest.groups_cache%}<ahref="/admin">AdminPanel</a>{%endif%}# or use templatetag, note that templatetag is slower{%loadhas_group%}{%ifrequest.user|has_group:"admins"%}<ahref="/admin">AdminPanel</a>{%endif%}Turn on caching:CACHES={'default':{'BACKEND':'django.core.cache.backends.memcached.MemcachedCache','LOCATION':'127.0.0.1:11211',}}Seehttps://docs.djangoproject.com/en/1.10/topics/cache/#memcachedfor more details on setting
up memcached.Note**Usingdjango.core.cache.backends.locmem.LocMemCacheis not safe for production unless you are
only running a single process (and odds are you aren’t).Seehttps://docs.djangoproject.com/en/1.10/topics/cache/#local-memory-cachingfor more details.FeaturesAddsgroups_cacheproperty torequestobjectProvides templatetaghas_groupInvalidates cache onUserorGroupmodel changes and on m2mgroupsManyToManyField changesFully tested with high coverageRunning Testssource <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.5.5 (2017-01-13)Bug fix for templatetaghas_groupTests added for 100% coverage of templatetag folder0.5.5 (2017-01-12)Omit urls.py from coverage report (not used but needed for django package)Omit apps.py from coverage report (default apps file)0.5.4 (2017-01-12)Removal of py32/django1.8 support from Travis CI build0.5.3 (2017-01-12)Fixing .travis.yml file and CI builds0.5.2 (2017-01-12)Typo in README.rst0.5.1 (2017-01-12)Add codecov.io supportDocumentation updates0.5.0 (2017-01-12)Add requirements.txt to tox.ini so tests can runFix broken compatibility with Django 1.8/1.9 due to backwards incompatible changes in 1.9/1.10 code0.4.0 (2017-01-12)Add test suite that generates 100% coverageFixed a bug found by test suite with cache not invalidating on thegroupsManyToManyField changing0.3.1 (2017-01-11)Documentation updates0.3.0 (2017-01-11)First stable and working release on PyPI.0.1.0 (2017-01-11)First release on PyPI.
Package: django-groups-sync
Django Groups SyncOverviewA set of management commands to export and sync Django User Groups permissions between environments.Getting It$ pip install django-groups-syncIf you want to install it from source, grab the git repository from GitHub and run setup.py:$ git clone git://github.com/hansek/django-groups-sync.git
$ cd django-groups-sync
$ python setup.py installInstalling ItTo enablegroups_syncin your project you need to add it toINSTALLED_APPSin your projectssettings.pyfile:INSTALLED_APPS = (
    ...
    'groups_sync',
    ...
)SettingsGROUP_SYNC_FILENAMEFilename (and location) of JSON file for export/sync, default valuegroups_permissions.json.UsageThere are two management commands.If you dont want anything to be displayed on stdout use verbosity argument-v0Export groups permissionsIt will save all groups permissions from database to json file.$ python manage.py export_groups_permissionsArgumentsone or multiple group names you only want to include in the export data$ python manage.py export_groups_permissions "Group 1" "Group 2"--file- specifies file to which the output is written (default value byGROUP_SYNC_FILENAME)Synchronize groups permissionsIt will update database groups permissions by content of json file.$ python manage.py sync_groups_permissionsArgumentsA Group name(s) which should only be synchronized (use "" if there are spaces in Group name).$ python manage.py export_groups_permissions "Group 1" "Group 2"--file- specifies json data file (default value byGROUP_SYNC_FILENAME)--noinputor--no-input- do NOT prompt the user for input of any kind--dry-runor-n- do everything except modify the databaseCreditsInspired byDan's Cheat Sheets > Permissions.Cheers
Package: django-group-user-mngt
Manage groups and users using jquery jtablesettings.pyAdd to INSTALLED_APPS : ‘group_user_mngt’,GROUP_MANAGEMENT_TEMPLATE = ‘manage_groups.html’Replace the template with a customized template (See below how to create)urls.pyurl(r’^groupmanagement/’, include(‘group_user_mngt.urls’, namespace=”gm_space”)),copy following filesThe dist-packages subdirectory in the examples below is just an example.  It all depends on
how this package was installed (with or without env, ubuntu/windows, …)Under static root :mkdir group_user_mngt
cd group_user_mngt
cp -r /usr/local/lib/python2.7/dist-packages/group_user_mngt/static/group_user_mngt/* .Group viewhttp://<FQDN>/groupmanagement/group/update/Template creation{% extends "group_user_base.html" %}<!DOCTYPE html><html><head>{% block head_group %}
        {{ block.super }}
        {% endblock %}</head><body><article>{% block group_user %}
        {{block.super}}<divid="GroupMngt"class="grid_16">{% csrf_token %}</div>{% endblock %}
        {% block user_group %}
        {{block.super}}<divid="UserMngt"class="grid_16">{% csrf_token %}</div>{% endblock %}</article></body></html>Future workCSRF supportEdit permissionsImprove portability of app…
Package: djangogrpcframework
Django gRPC framework is a toolkit for building gRPC services, inspired by
djangorestframework.RequirementsPython (3.6, 3.7, 3.8)Django (2.2, 3.0), Django REST Framework (3.10.x, 3.11.x)gRPC, gRPC tools, proto3Installation$pipinstalldjangogrpcframeworkAdddjango_grpc_frameworktoINSTALLED_APPSsetting:INSTALLED_APPS=[...'django_grpc_framework',]DemoHere is a quick example of using gRPC framework to build a simple
model-backed service for accessing users, startup a new project:$django-adminstartprojectdemo$pythonmanage.pymigrateGenerate.protofiledemo.proto:pythonmanage.pygenerateproto--modeldjango.contrib.auth.models.User--fieldsid,username,email--filedemo.protoGenerate gRPC code:python-mgrpc_tools.protoc--proto_path=./--python_out=./--grpc_python_out=././demo.protoNow edit thedemo/urls.pymodule:fromdjango.contrib.auth.modelsimportUserfromdjango_grpc_frameworkimportgenerics,proto_serializersimportdemo_pb2importdemo_pb2_grpcclassUserProtoSerializer(proto_serializers.ModelProtoSerializer):classMeta:model=Userproto_class=demo_pb2.Userfields=['id','username','email']classUserService(generics.ModelService):queryset=User.objects.all()serializer_class=UserProtoSerializerurlpatterns=[]defgrpc_handlers(server):demo_pb2_grpc.add_UserControllerServicer_to_server(UserService.as_servicer(),server)That’s it, we’re done!$pythonmanage.pygrpcrunserver--devYou can now run a gRPC client to access the service:withgrpc.insecure_channel('localhost:50051')aschannel:stub=demo_pb2_grpc.UserControllerStub(channel)foruserinstub.List(demo_pb2.UserListRequest()):print(user,end='')
Package: django-grpc-framework
gRPC for Django inspired by djangorestframework.DocumentationThe full documentation is athttps://django-grpc-framework.readthedocs.io.QuickstartInstall django-grpc-framework:pip install django-grpc-frameworkAdd it to yourINSTALLED_APPS:INSTALLED_APPS = [
    ...
    'grpc_framework',
]Create your grpc app:python manage.py grpcstartapp <app_name>Define your proto in <app_name>/<app_name>.proto.Add your app to GRPC_APPS:GRPC_APPS = [
    '<app_name>',
]Generate protocol buffer compiler:python manage.py grpcgenerateCreate your service in <app_name>/service.py.Start a grpc server with your apps:python manage.py grpcrunserverTodosupport asyncmore interceptorsRunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxHistory0.1.0 (2020-02-11)First release on PyPI.0.2.0 (2020-02-23)Add tests and docs.