Saravanan666/pypi-org huggingface dataset:
Package: django-check-migration-wtf
django-check-migration-wtfDescriptiondjango-check-migration-wtfis an extension for Django to check migrations and notify you if their are secure to do
on environments with zero downtime.In some situations Django Migration system generate migrations to need do a downtime because they are blocking operation
or you write custom migration than can block you database.Actually this extension only works for backends of PostgresSQL and Postgis, versions support 11, 12, 13 and 14.Advise: this extension notify you for common blocking operations on database. Anyway you should review your migrations and understand their.ConfigurationIt is really simpleInstallationInstall the package with the typical tool (pip):pip install django-check-migration-wtfAdd to your projectAdd app on your settings:INSTALLED_APPS=['django_check_migration_wtf',...,]Add some optional varsAdd some optional setup on your settings:CHECK_MIGRATION_WTF_PSQL_VERSIONIt is to know your PostgresSQL Version by default it is 9The next following vars are for use github integration:CHECK_MIGRATION_WTF_GITHUB_TOKENToken to can use API of github, It only need permission of reading of repo.CHECK_MIGRATION_WTF_REPO_NAMEName of repository on GithubUsageIt is really easy to use. It is execute by a typical django command likemakemigrationsormigrate...
It has two mode of usage.LocalFirst execute yourmakemigrationsand you can do your custome modifications. Thenbeforeexecute commandmigrateexecute the following command:python manage.py check_migrationIt will search all migrations that are not apply to the system (likeshowmigrations) and it will analyze if they are secure to do.You can have two possibilities:When the migration or migrations aresecure, you get the following response:When the migration or migrations arenot secure, you get the following response:GithubThis is reality an option of command to execute it on your continues integration.
It will search you migrations comparing the base branch and your current branch and the analyze itpython manage.py check_migration --github <head_ref> <base_ref>LimitationsThis extension not analyze code inside ofRunPythonGithub option to work correctly suppose your migrations are inside of directorymigrations
Package: django-cheetahtemplate
Django-CheetahTemplate is a Django template backend to useCheetahTemplate3in Django.It works with Python 2.7 or Python 3.4+, Django 1.11 and 2+,
CheetahTemplate3.Installdjango-cheetahtemplate. Add or change TEMPLATES insettings.pythe following way:TEMPLATES=[{'APP_DIRS':True,'BACKEND':'django_cheetahtemplate.DjangoCheetahTemplate','DIRS':[],'OPTIONS':{},},]Put templates incheetahtemplatesubdirectories of installed
applications. Seeexample.Author: Oleg Broytman <phd@phdru.name>.Copyright (C) 2018-2022 PhiloSoft Design.License: MIT.Home Page:https://github.com/CheetahTemplate3/django-cheetahtemplatePyPI:https://pypi.org/pypi/django-cheetahtemplate
Package: django-cheroot
Django CherootDjango Cheroot provides a bridge to useCherootwhich is the high-performance, pure-Python HTTP server used by CherryPy.Alternative for other WSGI servers like Gunicorn, etc.Installpip install django-cherootInsettings.pyadd application toINSTALLED_APPSINSTALLED_APPS=[...'django_cheroot',]UsageSimplest usage with default settings is:pythonmanage.pycherootDefault argumentspythonmanage.pycheroot-h127.0.0.1-p8000-w40-t30-c20pythonmanage.pycheroot--host127.0.0.1--port8000--maxthreads40--minthreads30--connections20ArgumentsNameShortLongTypeDefaultIP Address-ip--hostipstr127.0.0.1Port-p--portint8000Max Worker Threads-w--maxthreadsint40Min Threads in Thread Pool-t--minthreadsint30Max Queued Connections-c--connectionsint20
Package: django-cherrydev
DescriptionThis utility is a substitute for Django’srunservercommand. It was
inspired byGunicorn’sgunicorn_djangocommand which makes it so easy
to serve Django projects without having to create extra WSGI scripts.I chose to use CherryPy as it is pure Python (thus cross-platform) and quite
efficient in its own right. It also had the functionality I desired to be able
to serve static media without fuss while developing Django applications.To be clear, this utility will automatically serve your static media (as well
as admin media) without needing to modify your settings.py or maintain a
development version of your settings.To do this, it modifies your settings.MEDIA_URL and settings.ADMIN_MEDIA_PREFIX
on the fly before loading Django, which is also the reason that it is not
provided as a custom management command.Requirements and InstallationIn its present incarnation, this utility requires Python 2.7 and CherryPy 3.1
or above. Also, it is assumed you have Django installed.Installation is as simple aspip installdjango-cherrydev. This will
also install CherryPy if it isn’t already available.SourceYou can install the latest development version from thehg repositorywithpip install-ehg+http://code.db-init.com/django-cherrydevor from atarballwithpip installdjango-cherrydev==dev.UsageDjango-CherryDev provides a single script,cherrydev, which uses CherryPy
to serve your Django project and media files. To use it, simply CD into your
Django project directory and runcherrydev:$ cd myproject
$ cherrydevArgumentsusage: cherrydev [-h] [–noreload] [-b ADDRESS] [–nomedia] [-m MEDIA_ADDR][–noadmin] [-a ADMIN_ADDR] [-l LINK_DIR]
[SETTINGS_PATH]positional arguments:SETTINGS_PATH         By default SETTINGS_PATH will look for settings.py inthe current directory.optional arguments:-h,--helpshow this help message and exit--noreloadTells CherryPy to NOT use the auto-reloader.-bADDRESS,--bindADDRESSThe socket to bind. A string of the form: ‘HOST’,
‘HOST:PORT’. An IP is a valid HOST. (default:
‘127.0.0.1:8000’)Media:By default, CherryPy will be used to serve your media. If your MEDIA_URL
includes a host component, it will be changed to an alternate port on
localhost. If your ADMIN_MEDIA_PREFIX includes a host component that does
not match that of MEDIA_URL, it will also be changed to its own alternate
port.--nomediaTells CherryPy to NOT host media.-mMEDIA_ADDR,--mediaMEDIA_ADDRThe socket to bind media. A string of the form:
‘HOST’, ‘HOST:PORT’. An IP is a valid HOST. (default:
‘127.0.0.1:8001’)--noadminTells CherryPy to NOT host admin media.-aADMIN_ADDR,--adminADMIN_ADDRThe socket to bind admin. A string of the form:
‘HOST’, ‘HOST:PORT’. An IP is a valid HOST. (default:
‘127.0.0.1:8002’)-lLINK_DIR,--linkLINK_DIRAn additional directory to be linked to MEDIA_URL. May
be used multiple times. A string of the form:
‘PATH=DIRECTORY’. (e.g. ‘app=../myapp/media’)
Package: django-chile-payments
# django-chile-paymentsOnline payments, “the chilean way”. A django app with a flexible architecture designed to be multi-broker payment processor. Originally developed with love at [Nomadblue](http://www.nomadblue.com).For now it only sports the“peso pesado”of online payments in Chile, an old folk well-known by local developers called [Webpay Plus](https://www.transbank.cl/public/pagina_producto_11.html) fromTransbank. In the close future, we plan to include other APIs (e.g. [DineroMail](https://cl.dineromail.com/desarrolladores/biblioteca) or [Servipag](https://www.servipag.com/Portal-De-Pagos-En-Linea/Home/botondepago)), eventually becoming a de-facto package for Django payment processing in Chile.## DocumentationRead it online [here](http://nomadblue.viewdocs.io/django-chile-payments) or directly from the [‘docs/’](https://github.com/Nomadblue/django-chile-payments/tree/master/docs) folder in the source code.
Package: django-chili
Django Chiliis a Django extension that enables the use of static HTML files as Django
templates. It’s designed for scenarios where UI designs are created using
tools like Figma/Anima or Bootstrap Studio and need to be integrated into Django projects.
The extension adds tags to Django that can load static HTML files and uses CSS selectors
to transform and decorate them into Django templates. This allows developers to work on the
Django logic separately, without altering the original HTML that designers are producing.Documentationhttps://docs.django-chili.io/en/latest/
Package: django-chime
django-chimeCOVID-19 Hospital Impact Model for Epidemics (CHIME) app for Django.Free software: MIT licenseDocumentation:https://django-chime.readthedocs.io.FeaturesRe-usable application for deploying CHIME models in a Django projectProvides database models for assumption persistenceIntegrates with Django’s user and auth infrastructure for privacy and securityFast and lightweight platform allows hosting many models on the same websiteBuilt using the latestUPenn CHIME modelCreditsThe CHIME model and source code is Copyright © 2020, The Trustees of the University of Pennsylvania and was released for public use under the MIT License.  Please visit theirlive applicationfor more information.The official UPenn CHIME project code base is being actively developed byCode for Philly.  Please visit theirproject on GitHubfor more information.History0.1.0 (2020-04-09)First release
Package: django-chit-chat
django-chit-chatchat for projects we help maintain @ckcinstallingpipinstalldjango-chit-chat# settings.pyINSTALLED_APPS=("django.contrib.auth","django.contrib.contenttypes","django.contrib.sessions","django.contrib.staticfiles",# ... add chit_chat"chit_chat",)# routing.pyfromchannels.authimportAuthMiddlewareStackfromdjango.core.asgiimportget_asgi_applicationfromchannels.routingimportProtocolTypeRouter,URLRouterimportchit_chat.routingapplication=ProtocolTypeRouter({'http':get_asgi_application(),'websocket':AuthMiddlewareStack(URLRouter(chit_chat.routing.websocket_urlpatterns)),})# urls.pyfromrest_frameworkimportroutersfromchit_chat.viewsetsimportRoomViewSetrouter=routers.SimpleRouter()router.register('chatrooms',RoomViewSet)urlpatterns=router.urls<!-- chat.html --><script>// Open a connection to django-chit-chatYourWebsocketThing.open(`wss://${window.location.host}/ws/chatroom/`)// Write messages to screen as they're sent/receivedYourWebsocketThing.onmessage(msg=>writeMessageToScreen(JSON.parse(msg.data)))// You can do a GET to "/api/chatrooms/" for a list of chatrooms + messages$.get("/api/chat/rooms").success(d=>...)// Send a messagefunctionsend_message(text){WSClient.send(JSON.stringify({message_type:"chat",room:1,// ID of chat roomtext:text}))}</script>tests$dockerbuild-tdjango-chit-chat.&&dockerrundjango-chit-chatpytestReleasingUpdate version number insetup.cfg.Create release using Github's UI.Click theChoose a tagdropdown and create a new tag with the new version number.Click theGenerate release notesbutton to automatically create release notes.This will trigger an action to build and push the release to PyPi.
Package: django-choice-enumfields
This package lets you use real Python (PEP435-style) enums with Django.Installationpip installdjango-choice-enumfieldsIncluded ToolsEnumField, NumEnumFieldfromenumfieldsimportEnumFieldfromenumfieldsimportChoiceEnum# Uses Ethan Furman's "enum34" backportclassColor(ChoiceEnum):RED='r'GREEN='g'BLUE='b'classMyModel(models.Model):color=EnumField(Color,max_length=1)Elsewhere:m=MyModel.objects.filter(color=Color.RED)NumEnumFieldworks identically, but the underlying storage mechanism is
anIntegerFieldinstead of aCharField.EnumSubField, NumEnumSubFieldfromenumfieldsimportEnumField,EnumSubFieldfromenumfieldsimportChoiceEnumclassColor(ChoiceEnum):RED='r'GREEN='g'BLUE='b'classColorType(ChoiceEnum):LIGHT=Choice('l','light',parents=(Color.RED,Color.BLUE))DARK=Choice('d','dark',parents=(Color.RED,Color.GREEN))TRANSPARENT=Choice('t','transparent',parents=(Color.GREEN))classMyModel(models.Model):color=EnumField(Color,max_length=1)color_type=EnumSubField('color',ColorType,max_length=1)MyModel(color=Color.RED,color_type=ColorType.LIGHT).full_clean()# OKMyModel(color=Color.RED,color_type=ColorType.TRANSPARENT).full_clean()# Raise ValidationErrorEnumSubFieldautomatically validates if parents requirement is satisfied.WithEnumSubField,EnumField,NumEnumSubFieldandNumEnumFieldcomes validation of initial and allowed transitions between choices out of the box.fromenumfieldsimportEnumFieldfromenumfieldsimportChoice,ChoiceEnumclassStateFlow(ChoiceEnum):START=Choice('s','start',next={'PROCESSING'})PROCESSING=Choice('p','processing',next={'END'},initial=False)END=Choice('e','end',next=set(),initial=False)classMyModel(models.Model):state=EnumField(StateFlow,max_length=1)MyModel(state=StateFlow.START).full_clean()# OK# Raise ValidationError because PROCESSING is not in initial statesMyModel(state=StateFlow.PROCESSING).full_clean()model=MyModel.objects.create(StateFlow.START)model.state=StateFlow.END# Raise ValidationError because END is not next state after STARTmodel.full_clean()model.state=StateFlow.PROCESSINGmodel.full_clean()# OKUsage in FormsCall theformfieldmethod to use anEnumFielddirectly in aForm.classMyForm(forms.Form):color=EnumField(Color,max_length=1).formfield()ChoiceEnumNormally, you just use normalPEP435-style enums, however, django-choice-enumfields
also encludes its own version of ChoiceEnum with a few extra bells and whistles.
Namely, the smart definition of labels which are used, for example, in admin
dropdowns. By default, it will create labels by title-casing your constant
names. You can provide custom labels with using Choice to define enum item.fromenumfieldsimportEnumField,ChoiceEnum,Choice# Our own Enum classclassColor(ChoiceEnum):RED=Choice('r','A custom label')GREEN='g'BLUE='b'classMyModel(models.Model):color=EnumField(Color,max_length=1)assertColor.GREEN.label=='Green'assertColor.RED.label=='A custom label'EnumFieldListFilterenumfields.admin.EnumFieldListFilteris provided to allow using enums inlist_filter.fromenumfields.adminimportEnumFieldListFilterclassMyModelAdmin(admin.ModelAdmin):list_filter=[('color',EnumFieldListFilter)]
Package: django-choicefield
Django ChoiceFieldMotivationHave you also felt annoyed by having to convertDjango's enumeration typesbackto its type? Using tricks seen below to cast it.classSuit(models.IntegerChoices):DIAMOND=1SPADE=2HEART=3CLUB=4classCard(models.Model):suit_kind=models.IntegerField(choices=Suit.choices,db_column="suit")@propertydefsuit(self)->Suit:returnSuit(self.suit_kind)This is whatdjango-choicefieldhelps out with. While it additionally supports using
Python's nativeenum.Enumto express
column values.FeaturesUsing Django's enumeration typesimportchoicefieldfromdjango.dbimportmodelsclassSuit(models.IntegerChoices):DIAMOND=1SPADE=2HEART=3CLUB=4classCard(models.Model):suit=choicefield.ChoiceField(Suit)instance=Card.objects.create(suit=Suit.CLUB)assertinstance.suitisSuit.CLUBThere's also support for Django'smodels.TextChoices.Using Python's native enumerationimportchoicefieldfromenumimportEnumfromdjango.dbimportmodelsclassSuit(int,Enum):DIAMOND=1SPADE=2HEART=3CLUB=4classCard(models.Model):suit=choicefield.ChoiceField(Suit)instance=Card.objects.create(suit=Suit.DIAMOND)assertinstance.suitisSuit.DIAMONDPassing enum valuesIt's also possible to pass thevalueof an enum, which will be converted to its
corresponding enum instance.instance=Card(suit=2)assertinstance.suitisSuit.SPADEinstance.save()assertinstance.suitisSuit.SPADEinstance=Card.objects.get(suit=2)assertinstance.suitisSuit.SPADEGetting stored database valuesIf you want to access the stored database values, without conversion to your enum type,
you can use the registered__rawtransformer.Card.objects.values("suit__raw")# <QuerySet [{'suit__raw': 2}]>Getting unrecognized values from databaseIn case of e.g. a migration where an enum has changed by, say, removing a value. The
database could have values not recognized by the registered enum. Thus it could be
necessary to retrieve valueswithoutcasting them to an enum instance, as it'd raise
an error.It can be done using the__rawtransformer while also sidestepping enum validation in
filter values by usingValueexpressionsCard.objects.filter(suit=Value(1337)).values_list("suit__raw",flat=True)# <QuerySet [(1337,)]>InstallationUsingpip$pipinstalldjango-choicefieldDevelopmentRunning testsRunning the whole test matrix$toxSetting up a development environment$tox-edevRunning the test suite for one environment (non editable)e.g.Django==4.0.xandPython3.11$tox-edjango40-py311Start a local example projectThere are a couple of shortcut commands available usingTaskfile, for your convenience.e.g.$taskmanage--createsuperuser$taskrunserverAfterinstalling Taskfileyou can runtask --list-allto find all available commands.Compatibilitydjango-choicefieldis tested according to the table belowDjango versionPython version5.0.x^3.104.2.x^3.94.1.x^3.94.0.x^3.93.2.x^3.9
Package: django-choices
Order and sanity for django model choices.DISCLAIMERNew projects should not use this package. Existing users can follow the migration guide
in thedocumentation.Note:Django 3.0 addedenumeration types.
This feature mostly replaces the need for Django-Choices.
See alsoAdam Johnson’s post on using them.IntroductionDjango choices provides a declarative way of using thechoicesoption ondjangofields.See thedocumentationon ReadTheDocs on how to use this library.LicenseLicensed under theMIT License.Source CodeThe source code can be found ongithub.
Package: django-choices-enum
django-choices-enum===================django-choices-enum allows the usage of the 2.x backport of Python 3.4's enumpackage (enum34) as choices in Django models.from django.db import modelsfrom django_choices_enum import ChoicesEnumclass Monster(models.Model):class Types(str, ChoicesEnum):BEAST = ('beast', 'Beast')UNDEAD = ('undead', 'Undead')HUMAN = ('human', 'Human')name = models.CharField(max_length=40)type = models.CharField(max_length=40, choices=Types.choices())You may now write code like this:monsters = Monster.objects.filter(type=Monster.Types.BEAST)for m in monsters:assert m.type == Monster.Types.BEASTm = Monster(name='Vampire', type=Monster.Types.UNDEAD)m.save()Details=======Each enumeration is a class subclassed from the type of the field and theChoicesEnum type:class MyIntEnumeration(int, ChoicesEnum):A = (1, 'Label A')Each constant is then assigned a tuple of (value, label) as expected bythe Django choices parameter.  If the constant and label are the same,you may omit the tuple and simply set the constant equal to the value ofthe choice.Contributions=============I did not really write most of this code.  It was found and fixed froma Gist:https://gist.github.com/dstufft/5600529
Package: django-choices-enums
django-choices-enumsThe enum type used for Django choices enables Django’s choices to
support code prompts!!用于django choices的枚举类型，使得django的choices支持代码提示！！依赖python3+Installationpip install django-choices-enumsUsagefromdjango_choices_enumsimportDjangoChoicesEnumclassTypeChoices(DjangoChoicesEnum):Created=(1,'created')Finished=(2,'finished')classFoo(models.Model):type=models.IntegerField(choices=TypeChoices.to_django_choices())use enum like this:f=Foo.create(type=TypeChoices.Created)get all values:print(TypeChoices.all_values())# Out: [1, 2]anonymous values:fromdjango_choices_enumsimportDjangoChoicesEnumclassMyEnum(DjangoChoicesEnum):A=(1,'xxx')B=(2,'xxx')anonymous=((3,'xx'),(4,'xx'),)print(MyEnum.all_values())# Out: [(1, 'xxx'), (2, 'xxx'), (3, 'xx'), (4, 'xx')]get verbose:fromdjango_choices_enumsimportDjangoChoicesEnumclassMyEnum(DjangoChoicesEnum):A=(1,'A ...')B=(2,'B ...')anonymous=((3,'33'),(4,'44'),)print(MyEnum.A.verbose)# Out: A ...print(MyEnum.get_verbose(2))# Out: B ...print(MyEnum.get_verbose(3))# Out: 33print(MyEnum.get_verbose(MyEnum.B))# Out: B ...
Package: django-choices-field
django-choices-fieldDjango field that set/get django's new TextChoices/IntegerChoices enum.Installpipinstalldjango-choices-fieldUsageimportenumfromdjango.dbimportmodelsfromdjango_choices_fieldimportTextChoicesField,IntegerChoicesField,IntegerChoicesFlagclassMyModel(models.Model):classTextEnum(models.TextChoices):FOO="foo","Foo Description"BAR="bar","Bar Description"classIntegerEnum(models.IntegerChoices):FIRST=1,"First Description"SECOND=2,"Second Description"classIntegerFlagEnum(IntegerChoicesFlag):FIRST=enum.auto(),"First Option"SECOND=enum.auto(),"Second Option"THIRD=enum.auto(),"Third Option"text_field=TextChoicesField(choices_enum=TextEnum,default=TextEnum.FOO,)integer_field=IntegerChoicesField(choices_enum=IntegerEnum,default=IntegerEnum.FIRST,)flag_field=IntegerChoicesFlagField(choices_enum=IntegerFlagEnum,default=IntegerFlagEnum.FIRST|IntegerFlagEnum.SECOND,)obj=MyModel()reveal_type(obj.text_field)# MyModel.TextEnum.FOOassertisinstance(obj.text_field,MyModel.TextEnum)assertobj.text_field=="foo"reveal_type(obj.integer_field)# MyModel.IntegerEnum.FIRSTassertisinstance(obj.integer_field,MyModel.IntegerEnum)assertobj.integer_field==1reveal_type(obj.flag_field)# MyModel.IntegerFlagEnum.FIRST | MyModel.IntegerFlagEnum.SECONDassertisinstance(obj.integer_field,MyModel.IntegerFlagEnum)assertobj.flag_field==3NOTE: TheIntegerChoicesFlagrequires python 3.11+ to work properly.LicenseThis project is licensed under MIT licence (seeLICENSEfor more info)ContributingMake sure to havepoetryinstalled.Install dependencies with:poetryinstallRun the testsuite with:poetryrunpytestFeel free to fork the project and send me pull requests with new features,
corrections and translations. I'll gladly merge them and release new versions
ASAP.
Package: django_choices_flow
Meta Choice with simple flow and rulesUsagefromdjango.dbimportmodelsfromdjango_choices_flowimportChoicesfromdjango_choices_flow.modelsimportFlowIntegerFieldclassMyChoices(Choices):NEW=1,'New content'# 'New content' is the display textWAIT=2,'Wait'CANCELED=-1,'Canceled'ERROR=-2,'Error'INVOICED=3,'Invoiced'# set transaction rulesNEW_RULES=[NEW,INVOICED,CANCELED,ERROR]WAIT_RULES=[CANCELED,ERROR,INVOICED]INVOICED_RULES=[CANCELED]classInvoces(models.Model):"""
    To use only choices
    """number=models.IntegerField()status=models.IntegerField(choices=MyChoices,default=MyChoices.NEW)def__unicode__(self):returnself.numberclassFlowInvoice(models.Model):"""
    To validate flow in choices
    """number=models.IntegerField()status=FlowIntegerField(choices=MyChoices,default=MyChoices.NEW)def__unicode__(self):returnself.numberShell>>>flow=FlowInvoice.objects.create(number=1234)>>>flow.status1>>>flow.status=MyChoices.INVOICED>>>flow.full_clean()>>>flow.save()>>>flow.status3>>>flow.status=MyChoices.WAIT>>>flow.full_clean()ValidationError:{'status':[u'Invalid choice: Wait']}Developer# download codegitclonegit@github.com:valdergallo/django-choices-flow.git# install developer packagesmake# check coveragemakecoverage# test projectmaketest#clean extra contentmakeclean#send packagemakesend_package#test py2 and py3toxLicense type: FREEBSD
South: Support migrations
Python: python 2.7 and python 3.3
Version: 0.9.2
Tested in Django: 1.2.x; 1.3.x; 1.4.x; 1.5.x; 1.6.x; 1.7.x