Saravanan666/pypi-org huggingface dataset:
Package: django-croppy
django-croppyenables creating custom crops of images by specifying
a name, coordinates, width and height of the crop.django-croppyprovides a custom model field responsible for creating
and deleting crops. Crops are stored as serialized JSON data on the same
model as the image field viadjango-jsonfield.django-croppyis useful if you want to manually curate the crop size
and location instead of relying on generic cropping likedjango-imagekitprovides.django-croppymakes use of image processors provided bydjango-imagekit.UsageFirst, create your model with a crop field. You can specify a custom
location where to save crops to with theupload_toparameter:from django.db import models
from croppy.fields import CropField

def upload_to(instance, filename, crop_name):
    """
    Default function to specify a location to save crops to.

    :param instance: The model instance this crop field belongs to.
    :param filename: The image's filename this crop field operates on.
    :param crop_name: The crop name used when :attr:`CropFieldDescriptor.crop` was
        called.
    """
    filename, ext = os.path.splitext(os.path.split(filename)[-1])
    return os.path.join('crops', u'%s-%s%s' % (filename, crop_name, ext))

class Image(models.Model):
    image = models.ImageField()
    crops = CropField('image', upload_to = upload_to)The createdcropsfield allows you to create, delete and inspect
crops.$ git clone git@github.com:caffeinehit/django-croppy.git
$ cd django-croppy
$ python manage.py syncdb
...
$ python manage.py shell
...
>>> from tests.app import tests
>>> image = tests.get_image('test.tiff')
>>> image
<Image: Image object>
>>> image.image
<ImageFieldFile: images/test.tiff>
>>> image.image.path
u'/home/alen/projects/django-croppy/tests/test-media/images/test.tiff'

>>> # Inspect the crop data
>>> image.crops.data
{}

>>> # Create a new crop called 'rect' at position 0/0
>>> # with a width of 100px and a height of 50px
>>> image.crops.create('rect', (0, 0, 100, 50))

>>> # Inspect the crop data
>>> image.crops.data
{'rect': {'y': 0, 'width': 100, 'height': 50, 'filename': 'crops/test-rect.tiff', 'x': 0}}

>>> # Inspect the crop
>>> image.crops.rect.name
'crops/test-rect.tiff'
>>> image.crops.rect.path
u'/home/alen/projects/django-croppy/tests/test-media/crops/test-rect.tiff'
>>> image.crops.rect.url
'/test-media/crops/test-rect.tiff'

>>> # Save the data to database
>>> image.save()

>>> # Delete the crop
>>> image.crops.delete('rect')
>>> image.crops.data
{}
Package: django-crossbar
===============================================django-crossbar - Crossbar.io Integration for Django===============================================.. image:: diagram.png:Version: 0.1:Web: https://git.atm4coin.com/root/django-crossbar/:Download: http://pypi.python.org/pypi/django-crossbar/:Source: https://git.atm4coin.com/root/django-crossbar/:Keywords: crossbar, django, celery, python--WARNING=======This software is experimental and incomplete!Overview========All RPC + Pubsub activites are handled by celery tasks, of which there are several types.The first is a classic celery task where you can write your own code (CROSSBAR_CELERY_TASKS).The rest are generic celery tasks to acieve object_list, object_detail, object_update & object create (for database objects).These are all sepecified in django settings.py fileInstallation=============You can install ``django-crossbar`` either via the Python Package Index (PyPI)or from source.To install using ``pip``,::$ pip install django-crossbarOR from source$ pip install git+https://git.atm4coin.com/root/django-crossbar.gitAdd "djcb" and "djcelery" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [...'djcelery','djcb',]Do crossbar / django-crossbar setup./manage.py djcb_initRun your project with:$ crossbar startNote: You need to make sure prerequisites for celery etc are setup (message broker etc)
Package: django-crossdomainmedia
Cross-Domain Media with authentication for DjangoThe situation: You serve media files from a different domain than your main web application domain (good idea). You want to usenginx's internal redirect (X-Accel-Redirect)to authorize media file delivery.The problem:  You don't have access to the user's session on the media domain and can't authenticate or authorize media access.The solution: You handle media URLs with an expiring token attached which temporarily authorizes access and can be refreshed via redirects when needed.HTTP ViewHere's how it works in HTTP:-> GET media.example.org/path/file.pdf<- 302www.example.com/path/file.pdf-> GETwww.example.com/path/file.pdfif not authorized<- 403if authorized<- 302 media.example.org/path/file.pdf?token=XYZ-> GET media.example.org/path/file.pdf?token=XYZ<- 200 file.pdfafter expiry-> GET media.example.org/path/file.pdf?token=XYZSee step 2Use in Django# DevelopmentMEDIA_URL='/media/'# ProductionMEDIA_URL='https://media.example.org/media/INTERNAL_MEDIA_PREFIX='/protected/'fromcrossdomainmediaimport(CrossDomainMediaAuth,CrossDomainMediaMixin)classCustomCrossDomainMediaAuth(CrossDomainMediaAuth):'''Create your own custom CrossDomainMediaAuth classand implement at least these methods'''SITE_URL='https://www.example.com'defis_media_public(self):'''Determine if the media described by self.contextneeds authentication/authorization at all'''returnself.context['object'].is_publicdefget_auth_url(self):'''Give URL path to authenticating viewfor the media described in context'''obj=self.context['object']raisereverse('view-name',kwargs={'pk':obj.pk})defget_media_file_path(self):'''Return the file path relative to MEDIA_ROOT'''obj=self.context['object']returnobj.file.nameclassCustomDetailView(CrossDomainMediaMixin,DetailView):'''Add the CrossDomainMediaMixinand set your custom media_auth_class'''media_auth_class=CustomCrossDomainMediaAuthSome other useful methods# Get your media URLs with token outside of viewmauth=CustomCrossDomainMediaAuth({'object':obj})mauth.get_full_media_url(authorized=True)# Send file via nginx internal redirect responsemauth.send_internal_file()Nginx configThis is how an Nginx config could look like.server{# Web server with session on domainlisten443sslhttp2;server_namewww.example.com;# ...location/{proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerX-Forwarded-Protohttps;proxy_set_headerHost$host;# etc...proxy_passwsgi_server;}}server{# Media server with no session on domainlisten443sslhttp2;server_namemedia.example.org;# ...location/media/{proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerX-Forwarded-Protohttps;proxy_set_headerHost$host;# etc...proxy_passwsgi_server;}location/protected{internal;alias/var/www/media-root;}}
Package: django-cross-origin
django-cross-originis a Django app enabling cross-origin resource sharing in views.FeaturesEnable CORS on Django class-based generic views with a simple mixin.Full customization of all CORS headers via accessor override.InstallationCheckout the latest django-cross-origin release and copy or symlink thecross_origindirectory into yourPYTHONPATH.  If using pip, runpip installdjango-cross-origin.Add'cross_origin'to yourINSTALLED_APPSsetting.UsageTo enable CORS on a Django class-based view, simply mixin thecross_origin.views.AccessControlMixinto your view:from django.views import generic
from cross_origin.views import AccessControlMixin

class YourView(AccessControlMixin, generic.TemplateView):

    """Your view code here!"""All CORS response headers can be customized by overriding accessor methods on your view. For a complete
list of available accessors, see the source code forAccessControlMixin.More informationThe django-cross-origin project was developed atMohawk, and
is released as Open Source under the MIT license.You can get the code from thedjango-cross-origin project site.ContributorsThe following people were involved in the development of this project.Dave Hall -Blog|GitHub|Twitter|Google Profile
Package: django-crowd
django-crowd============Simple Attlasian CROWD authentication backend for DjangoInstallation============pip install django-crowdAlso, to install development version you can try this:pip install git+git://github.com/gbezyuk/django-crowd.gitOr this:pip install -e git+git://github.com/gbezyuk/django-crowd.git#egg=Django-CrowdYou could also simply copy this repository crowd folder to your project.Configuration:==============Put a CROWD configuration in your settings.py:CROWD = {'url': 'http://your.crowd.url:port/crowd/rest',         # your CROWD rest API url'app_name': 'your-registered-crowd-application-name',   # appname, registered with CROWD'password': 'application-password',                     # correct password for provided appname'superuser': True,                                      # if set makes CROWD-authorized users superusers;# BE CAREFUL WITH THIS PARAMETER!}Also add 'crowd.CrowdBackend' in your AUTHENTICATION_BACKENDS settings list.Better to put it last for minimal collision risk:AUTHENTICATION_BACKENDS = (# ...'django.contrib.auth.backends.ModelBackend','crowd.backends.CrowdBackend')Credits:========Originally written for Django v1.3 by Konstantin J. Volkov <konstantin-j-volkov@yandex.ru> at 12.07.2012Refactored, put together and tested with Django v1.4 by Grigoriy Beziuk <gbezyuk@gmail.com> at 27.08.2012
Package: django-crowd-auth
This package includes a authentication backend and an authentication
middleware to integrate Django’s authentication system with Atlassian Crowd.When authenticating an user against Crowd,
its nested groups are retrieved and mirrored in Django.UsageTo authenticate users against Crowd,
adddjango_crowd_auth.backends.BackendtoAUTHENTICATION_BACKENDS.To enable single-sign-on,
adddjango_crowd_auth.middlewares.ssotoMIDDLEWARE.
Ensure you also havedjango.contrib.sessions.middleware.SessionMiddlewareanddjango.contrib.auth.middleware.AuthenticationMiddlewareplaced before it.Ensuredjango.contrib.sessionsis inINSTALLED_APPS.Add settings (see below)MiddlewaresOften the SSL session does not terminates directly on the Django application,
but on an intermediate proxy.This package also includes 3 middlewares that rewrites the user’sREMOTE_ADDRusing header set by these proxies:django_crowd_auth.middlewares.x_forwarded_for:
OverrideREMOTE_ADDRwith the firstX-Forwarded-Forentry.django_crowd_auth.middlewares.x_real_ip:
OverrideREMOTE_ADDRwith theX-Real-IPvalue.django_crowd_auth.middlewares.fake_remote_addr:
OverrideREMOTE_ADDRwith theFAKE_REMOTE_ADDRsettings value.WarningOnly use these middlewares when youKNOWwhat you’re doing.
Otherwise you could enable attackers to spoof their IP address.NoteAs the SSO middleware needsREMOTE_ADDR, these middlewares must be
declaredBEFOREthe SSO middleware.SettingsCROWD_CLIENT: must be a dict with these keys:crowd_url: mandatoryapp_name: mandatoryapp_pass: mandatoryssl_verify: defaults toTrue. Also accepts a path to a CA bundle.timeout: no timeout by defaultclient_certCROWD_USERS_ARE_ACTIVE: Defaults toTrue.
IfTrue, set theis_activeuser model attribute toTruewhen
creating Django users.CROWD_USERS_ARE_STAFF: Defaults toFalse.
IfTrue, set theis_staffuser model attribute toTruewhen
creating Django users.CROWD_SUPERUSERS_GROUP: If defined, set theis_superuseruser model
attribute toTruewhen they belong to the chosen group. By side effect,
these users also get theis_staffattribute set toTrue.CROWD_SESSION_VALIDATION_INTERVAL: Default to 300 seconds.
The user’s Crowd session is re-validated at this interval.ExampleCROWD_CLIENT={'crowd_url':'https://crowd.foo.bar','app_name':'foo','app_pass':'bar','ssl_verify':'/etc/pki/tls/certs/ca-bundle.crt','timeout':10,}CROWD_USERS_ARE_STAFF=TrueCROWD_SUPERUSERS_GROUP='administrators'AUTHENTICATION_BACKENDS=['django_crowd_auth.backends.Backend']MIDDLEWARE=['django.contrib.sessions.middleware.SessionMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django_crowd_auth.middlewares.sso',]SynchronizationWhile users and groups are created on the fly
(i.e. when they access the Django application),
it is sometimes necessary to mirror Crowd users and groups in Django.This package includes async_crowdmanagement command for this purpose.
To use it, simply adddjango_crowd_authto theINSTALLED_APPS.
Package: django-crowdsourcing
Django-crowdsourcing is an MIT-licensed survey and report tool for
journalists, supporting many types of survey questions and a wide
variety of reporting options.  A reusable Django application, it is
designed to be installed easily in any Django site, including
multi-site installations.  Its surveys are entirely configured within
the admin interface that ships with Django.While the primary focus of development is support for crowdsourcing
projects, the survey tool is general purpose and can be used for a
variety of applications.  It is easy enough to handle simple polls
with pie charts, yet powerful enough to handle complicated surveys
with rich multimedia responses plotted on a map with custom icons.History/CreditsDjango-crowdsourcing began life as a fork of Doug Napoleone’sdjango-survey.  Jacob Smullyan and James Richards started the project;
Dave Smith wrote most of the 1.x version.InstallationPrerequisites are:Django itself, of course – 1.4 or better.PILdjango-positionssorl-thumbnailflickrapi(optional)Django-crowdsourcing itself can be installed withpip:$ # probably in a virtualenv ...
$ pip install django-crowdsourcingRunning The Example App$ easy_install pip$ pip install -r crowdsourcing_requirements.txt$ pip install -r example_app/example_app_requirements.txtBy default the example app will use a sqlite db; if if you want to
change that, modify example_app/example_app/settings.py accordingly.$ cd example_app$ ./manage.py syncdb$ ./manage.py runserverAdd some surveys in /admin/NotesShould work under Django 1.4Only tested on Python 2.6DocumentationExtensive documentation is included, or can be readonline.Other ResourcesPython Cheeseshop page:http://pypi.python.org/pypi/django-crowdsourcingSource code repository and ticket tracker:http://code.google.com/p/django-crowdsourcing/Discussion group:http://groups.google.com/group/django-crowdsourcing/
Package: django-crud-app
django-crud-appthis module is extends ofdjango startappinstallpip install django-crud-appaddcrudto your django settings.pyexample)INSTALLED_APPS=[# ...'crud',]Usagepython manage.py startcrud <app_name>UserModelpython manage.py startcrud userorpython manage.py startcrud <app_name> --auth-user TrueModel nameyou can customize created model nameexample:pythonmanage.pystartcrudblog# model name is 'Blog'pythonmanage.pystartcrudblog--model-nameweb_blog# model name is 'WebBlog'
Package: django-crud-generator
Django CRUD GeneratorThis is a simple script to automate CRUD operations based onBase DjangobycontraslashPrerequisites:You have an existing django project with an app with a model to generate its crudYou have a template calledbase.htmland that template contains a block calledcontentYou have installedBase Django appand is already onINSTALLED_APPSonsettings.pyUsage:You should invoque this script using simethin like thiscdyour/app/path
pythondjango-crud-generator.py--model_nameModelNameAfter run the script add a attribute to your modelurl_name = conf.<MODEL_NAME>_DETAIL_URL_NAME.Be sure yourpath/to/application/urls.pyis routed by the mainurls.pyfile.Options:--model_prefix: Is used to prefix all configuration inconf.pyvariables for urls--url_pattern: Define the url pattern inside theurls.py--create_api: IfTruecreates an api based onDjango Rest Framework
Package: django-cruditor
UsagePlease refer to theDocumentationto
learn how to usedjango-cruditor. Cruditor is a set of generic class based views
with UIKit styled templates. Together with django-tables2, django-filter and
django-tapeforms this package provides you some easy to use Django views to build
your customized CRUD interface.Requirementsdjango-cruditor supports Python 3 only and requires at least Django 2.2.
Optional dependencies are django-tapeforms, django-tables2 and django-filter.Prepare for developmentA Python 3 interpreter is required in addition to poetry.$poetryinstall# If you want to build docs, execute this in addition$poetryinstall-EdocsNow you’re ready to start the example project to experiment with cruditor.$poetryrunpythonexamples/manage.pyrunserver
Package: django-cruds
django-cruds is simple drop-in django app that creates CRUD
(Create, read, update and delete) views for existing models and apps.django-cruds goal is to make prototyping faster.DocumentationTo add CRUD for whole app, add this to urls.py:from cruds.urls import crud_for_app
urlpatterns += crud_for_app('testapp')This will create following urls and appropriate views (assuming
there is a application namedtestappwith modelAuthor:URLname/testapp/author/testapp_author_list/testapp/author/new/testapp_author_create/testapp/author/(?P<pk>d+)/testapp_author_detail/testapp/author/(?P<pk>d+)/edit/testapp_author_update/testapp/author/(?P<pk>d+)/remove/testapp_author_deleteIt is also possible to add CRUD for one model:from django.db.models.loading import get_model
from cruds.urls import crud_for_model
urlpatterns += crud_for_model(get_model('testapp', 'Author'))crud_fieldstemplatetag displays fields for an object:{% load crud_tags %}

<table class="table">
  <tbody>
    {% crud_fields object "name, description" %}
  </tbody>
</table>Customizable CRUD url patternscrud_urls:urlpatterns += crud_urls(
    Author,
    list_view=MyAuthorListView.as_view(),
    activate=ActivateAuthorView.as_view(),
)Usecruds.util.crud_urlshortcut function to quickly get url for
instance for given action:crud_url(author, 'update')Is same as:reverse('testapp_author_update', kwargs={'pk': author.pk})cruds.util.crud_urlaccepts Model class as well for list actions, ie:crud_url(Author, ‘list’)
crud_url(Author, ‘create’)cruds.util.crud_permission_namereturns permission name using Django
naming convention, ie:testapp.change_author.Templatesdjango-cruds views will append CRUD template name to a list of default
candidate template names for given action.CRUD Templates are:cruds/create.html
cruds/delete.html
cruds/detail.html
cruds/list.html
cruds/update.htmlQuickstartInstall django-cruds:pip install django-crudsThen use it in a project, addcrudstoINSTALLED_APPS.RequirementsDjango>=3.2<=4.0
Package: django-cruds-mixins
EXPRERIMENTAL SOFTWARE! Do not use!django-cruds-mixins integrates several libraries to enable easy, fast and
predicatable creation of admin panels and applications.Featureslist, create, update, detail, delete views for your modelscustomizable tables with orderable columns, pagination and automatic links
for ForeignKey fields, easily customizable withdjango-tables2search fiters based on model fields withdjango-filterpermissions creation and integration withdjango-rulesadvanced forms withdjango-crispy-formsselections and bulk actionsutils for creating URLconfs, permissions, filtersets, tablesDocumentationThe full documentation is athttps://django-cruds-mixins.readthedocs.io.QuickstartInstall django-cruds-mixins:pip install django-cruds-mixinsAdd django-cruds-mixin and related apps to yourINSTALLED_APPS:INSTALLED_APPS=(...'rules.apps.AutodiscoverRulesConfig','crispy_forms','django_tables2','cruds','cruds_mixins',...)Add thedjango-rulesauthentication backend for using permissions.AUTHENTICATION_BACKENDS=('rules.permissions.ObjectPermissionBackend','django.contrib.auth.backends.ModelBackend',)Add django-cruds-mixins’s URL patterns:fromcruds_mixinsimporturlsascruds_mixins_urlsurlpatterns=[...url(r'^',include(cruds_mixins_urls)),...]Running TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackage
Package: django-crudviewset
Django CRUDViewSetRequirementsPython 3.6.*Django 2.*InstallationInstall usingpip...pipinstalldjango-crudviewsetAdd'crudviewset'to yourINSTALLED_APPSsetting.INSTALLED_APPS=(...'crudviewset',)ExampleSimple Exampleexample/views.pyfromcrudviewsetimportCRUDViewSetfromexample.modelsimportBoardBoardCRUDViewSet=CRUDViewSet('board',Board)example/urls.pyfrom.importviewsurlpatterns=[]urlpatterns.extend(views.BoardCRUDViewSet.get_urlpatterns())Custom Exampleexample/views.pyfromdjango.contrib.auth.mixinsimportUserPassesTestMixinfromcrudviewsetimportCRUDViewSet,ViewParams,VIEWKINDfromexample.modelsimportBoardfromexample.formsimportBoardFormclassBoardFormViewMixin:defget_form_kwargs(self):kwargs=super().get_form_kwargs()kwargs['user']=self.request.userreturnkwargsBoardCRUDViewSet=CRUDViewSet('board',Board,app_name='example',base_superclasses=[UserPassesTestMixin],base_variables={'test_func':lambdaself:self.request.user.is_authenticated,'get_queryset':lambdaself:Board.objects.filter(user=self.request.user).order_by('-created_at'),},list_vp=ViewParams(role=VIEWKIND.LIST,variables={'paginate_by':10,}),detail_vp=ViewParams(role=VIEWKIND.DETAIL,superclasses=[],variables={'get_queryset':lambdaself:Board.objects.all().order_by('-created_at'),}),create_vp=ViewParams(role=VIEWKIND.CREATE,superclasses=[UserPassesTestMixin,BoardFormViewMixin],variables={'form_class':BoardForm,'template_name':'example/example_form.html',}),update_vp=ViewParams(role=VIEWKIND.UPDATE,superclasses=[UserPassesTestMixin,BoardFormViewMixin],variables={'form_class':BoardForm,'template_name':'example/example_form.html',}),delete_vp=ViewParams(role=VIEWKIND.DELETE,variables={'success_url':reverse_lazy('main:example_list'),}),vp_list=[ViewParams(role=VIEWKIND.LIST,route='latest/',route_name='latest',variables={'paginate_by':10,'template_name':'example/latest.html','get_queryset':lambdaself:Board.objects.all().order_by('-created_at'),}),])example/urls.pyfrom.importviewsapp_name='example'urlpatterns=[]urlpatterns.extend(views.BoardCRUDViewSet.get_urlpatterns())
Package: django-crum
Django-CRUMDjango-CRUM (Current Request User Middleware) captures the current request and
user in thread local storage.It enables apps to check permissions, capture audit trails or otherwise access
the current request and user without requiring the request object to be passed
directly. It also offers a context manager to allow for temporarily
impersonating another user.It provides a signal to extend the built-in function for getting the current
user, which could be helpful when using custom authentication methods or user
models.Documentation can be found atRTFD.It is tested against:Django 1.11 (Python 3.5 and 3.6)Django 2.0 (Python 3.5, 3.6 and 3.7)Django 2.1 (Python 3.5, 3.6 and 3.7)Django 2.2 (Python 3.5, 3.6, 3.7, 3.8 and 3.9)Django 3.0 (Python 3.6, 3.7, 3.8 and 3.9)Django 3.1 (Python 3.6, 3.7, 3.8 and 3.9)Django master/3.2 (Python 3.6, 3.7, 3.8 and 3.9)