Saravanan666/pypi-org huggingface dataset:
Package: django-item-owner-model
django-item-owner-modelData item has owner and can be shared to other users. Login user can only see owned or shared data items. User with permit_all permission can see all data items.Installpipinstalldjango-item-owner-modelInstalled utilsdjango_item_owner_model.models.DjangoItemManagerdjango_item_owner_model.models.DjangoItemOwnerModelextra permissions:("django_item_owner_model_permit_all", _("Permit All")),django_item_owner_model.models.DjangoItemShareModelextra permissions:("django_item_share_model_permit_all", _("Permit All")),Note:DjangoItemOwnerModel and DjangoItemShareModel use the same custom manager: DjangoItemManager.Usagepro/settings.pyINSTALLED_APPS=[...."django_middleware_global_request","django_item_owner_model",...]MIDDLEWARE=[..."django_middleware_global_request.middleware.GlobalRequestMiddleware",...]We requiresrequestinstance in Model's Manager, so we have to use django_middleware_global_request to get request instance. See detail aboutdjango_middleware_global_requestathttps://pypi.org/project/django-middleware-global-request/.app/models.pyfromdjango.dbimportmodelsfromdjango_item_owner_model.modelsimportDjangoAdminItemOwnerModelfromdjango_item_owner_model.modelsimportDjangoAdminItemShareModelclassCategory(DjangoAdminItemOwnerModel,models.Model):title=models.CharField(max_length=32)def__str__(self):returnself.titleclassBook(DjangoAdminItemOwnerModel,DjangoAdminItemShareModel,models.Model):category=models.ForeignKey(Category,on_delete=models.SET_NULL,null=True,blank=True,related_name="books")title=models.CharField(max_length=32)def__str__(self):returnself.titleapp/admin.pyfromdjango.contribimportadminfromdjangoimportformsfrom.modelsimportCategoryfrom.modelsimportBookclassBookInline(admin.TabularInline):model=BookclassCategoryAdmin(admin.ModelAdmin):allow_super_user_see_all_items=Truelist_display=["title"]inlines=[BookInline,]classBookAdmin(admin.ModelAdmin):list_display=["title","owner","share_users_display"]defshare_users_display(self,obj):users=[str(x)forxinobj.share_users.all()]return",".join(users)admin.site.register(Category,CategoryAdmin)admin.site.register(Book,BookAdmin)Bug reportPlease report any issues athttps://github.com/zencore-cn/zencore-issues.Releasesv0.3.1 2020-09-07Doc fix.Add i18n.Rename django_item_owner_model.models.DjangoItemManager to django_item_owner_model.models.DjangoItemOwnerManager.v0.3.0 2020-06-22Change app's name fromdjango-admin-item-ownertodjango-item-owner-model.Use custom model Manager to control item access.Note:New version changes a lot.v0.2.0 2020-01-08Add ItemShareMixin for models and admins.v0.1.0 2019-12-01First release.
Package: django-ittybitty
This application offers those with Django-powered sites to have their very own
URL-shortening capabilities with great ease. For an idea of what “URL-shortening”
means, have a gander athttp://mashable.com/2008/01/08/url-shortening-services/or just Google “url shortening”. It’s kind of a big deal all of the sudden.Why should you use this when all of those services already exist online? Maybe
it’s just me, but I don’t like relying on 3rd party servers in order for my
site to function, and that includes relying on other servers for people to
follow a link to my site. With this application installed, you no longer need
to worry about downtime on those other servers affecting your traffic at all.
If people can’t get to your site using the shortened URLs generated by this
application, you probably have bigger problems (ie your site itself is down).
Package: django-ivc-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.4PostgreSQL (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-j2fa
django-j2fa2-factor SMS authentication for Django projects. Supports Django 3.x and 4.x.InstallAdd ‘j2fa’ to project settings INSTALLED_APPSAdd j2fa.middleware.Ensure2FactorAuthenticatedMiddleware to project settings MIDDLEWARE (after session middleware)Make sure user.profile.phone resolves to phone number and user.profile.require_2fa resolves to True/False. Alternatively, you can override Ensure2FactorAuthenticatedMiddleware.is_2fa_requiredSet project settings SMS_TOKEN and SMS_SENDER_NAMEAdd TwoFactorAuth.as_view() to urls with name=’j2fa-obtain-auth’Supported Settingsinsettings:
*SMS_TOKEN: Kajala Group (https://kajala.com) SMS API token. Contactinfo@kajala.comfor access
*SMS_SENDER_NAME: SMS sender name, max 13 characters
*J2FA_ENABLED: Enabled/disable 2FA system-wide. Default is True
*J2FA_SEND_TO_EMAIL: Send 2FA codes also to email. Default is False.
*J2FA_FALLBACK_TO_EMAIL: Send 2FA codes to email if SMS sending fails. Default is False.Static Code AnalysisThe library passes both prospector and mypy checking. To install:pip install prospector
pip install mypyTo analyze:prospector
mypy .
Package: django-jabber
Send Jabber notifications from DjangoUsagefromdjango_jabberimportsend_messagerecipients=['user1','user2',]# without @domain.com partsend_message(u'Hello there',recipients)# You can also pass this job to your Celery instancesend_message.delay(u'Async message',recipients)InstallationInstall the package via Pypi:pip install django-jabberAdd some lines to your settings.py:INSTALLED_APPS=(...'django_jabber',...)JABBER_HOST='jabber.domain.com'JABBER_USER='robot@domain.com'JABBER_PASSWORD='someStr0ngOne!1'JABBER_USE_TLS=TrueJABBER_USE_SSL=FalseJABBER_DRY_RUN=False# Useful for testingRequirementssleekxmppcelerydjangoCompatibilityWe use this package on Python 2.7 and Django 1.7+.LicenseGPLv3Authorsdjango-jabberwas written byAlex Morozov.
Package: django-jables
Jean-Baptiste, aka JablesThis package contains a single useful base model I was copying over and over onto every new project. It was time to package it up and reuse it.This is a basic model from which all the project's model should inherit. It is defined as "abstract".It defines a couple of basic fields every model should have:an ID as CharField/NanoID: this avoids that content could be "discovered" if using auto increment and instead is a better UUIDcreated_at: a datetime field with "auto_now_add", so we track when the model was created.updated_at: a datetime field with "auto_now", so we track when the model was last updated.The name comes from Django Reinhart father, Jean-Baptiste (or Jables, for short).How to use itInstall this package as any other requirement to your project.Addjablesto yourINSTALLED_APPS.When creating models, inherit fromJBModel:fromjables.modelsimportJBModelclassMyModel(JBModel):...
Package: django-jaeger-middleware
django-jaeger-middlewareThis is a simple jaeger tracing middleware for Django applications.I read Jaeger - Distributed Tracing System ongithuband make it plus.Installing$pipinstalldjango-jaeger-middlewareThen adddjango-jaeger-middleware.middleware.JaegerMiddleWareto the end yourMIDDLEWAREinsettings.py.For example:MIDDLEWARE = [
	...
	'django-jaeger-middleware.middleware.JaegerMiddleWare'
]Enjoy!Email me with any questions:galphaxie@gmail.com.
Package: django-jalali-date-3
# django-jalali-dateJalali Date support for user interface. Easy conversion of DateTimeFiled to JalaliDateTimeField within the admin site, view and templates.----------**DEPENDENCY**To use this module you need to install jdatetime(and of course you need django) and pytz module which you can install it with easy_install or pip----------**INSTALL**pip install django-jalali-date----------**USAGE**settings.pyINSTALLED_APPS = [...'jalali_date',...]python_file.py```pythonfrom jalali_date import datetime2jalali, date2jalalidef my_view(request):jalali_join = datetime2jalali(request.user.date_joined).strftime('%y/%m/%d _ %H:%M:%S')```template.html```html{% load jalali_tags %}<p>{{ request.user.date_joined|to_jalali:'%y/%m/%d _ %H:%M:%S' }}</p>```admin.py```pythonfrom django.contrib import adminfrom jalali_date.admin import ModelAdminJalaliMixin, StackedInlineJalaliMixin, TabularInlineJalaliMixinclass MyInlines1(TabularInlineJalaliMixin, admin.TabularInline):model = SecendModelclass MyInlines2(StackedInlineJalaliMixin, admin.StackedInline):model = ThirdModel@admin.register(FirstModel)class FirstModelAdmin(ModelAdminJalaliMixin, admin.ModelAdmin):inlines = (MyInlines1, MyInlines2, )```![example](http://bayanbox.ir/view/2877111068605695571/Screenshot-from-2016-07-26-01-37-07.png)
Package: django-jangle
jangleIETF BCP 47 / RFC 5646 language tags in DjangoUse in your project!Install jangle from PyPI:pip install django-jangle...or the latest version from GitHub:pip install git+https://github.com/egginabucket/jangle.gitAdd jangle to your project's installed apps:# settings.py

INSTALLED_APPS = [
    ...
    "jangle",
]Migrate database:python manage.py migrateSave jangle data to the project's database:python manage.py loadjangledataDocumentationDocumentation is available atjangle.readthedocs.io. Currently a work in progress.Some data providedISO 15924 scriptsfrom unicode.orgISO 639-1, 639-2/b, 639-2/tand639-5codes and names from the Library of CongressISO 639-3 code set, names and macrolanguagesfrom SIL InternationalISO 3166-1 and UN M.49 regions - currently a WIPFullIANA subtag registrysaved across various tables, including grandfathered and redundant tags. Linked with other standards and used to construct and verify language tags
Package: django-janitor
django-janitor allows you to use [bleach](https://bleach.readthedocs.io/)
to clean HTML stored in arbitrary Models.This is useful when you’ve got HTML content stored in a 3rd-party app, but
you’d like to use a whitelist for allowed HTML tags.## Featuresdjango-janitor listens for a Models’pre_savesignal, and runs it’s content
through bleach.Allowed HTML tags, attributes, and css are specified in a whitelistWhitelists are managed in Django’s AdminThere are (sensible) default whitelists included## RequirementsRequires BleachWorks with Django 1.11NOTE on upgrading to version 0.5.0: This version officially supports
Python 3 and  Django 1.11. Prior versions of this app included south migrations
and only supported something like Django 1.4. If you’re previously used this,
you’ll have to figure out how to upgrade your existing models (sorry).## InstallationTo install the most recent release:pip install django-janitorOr to install from the current repository:pip install git+https://github.com/bradmontgomery/django-janitorThen, addjanitorto your installed apps, and run the migrations.python manage.py migrate## UsageVisit the Janitor app in Django’s Admin, and create a newField sanitizer.
Then select the Model and specify the fieldname which should be cleaned. After
you set up the whitelists for Tags, Attributes, etc, save the Field sanitizer.From now on, when the Model is saved, it’s content in will be cleaned usingbleach.![screensho](https://raw.githubusercontent.com/bradmontgomery/django-janitor/master/screenshot.png)## TestsThere are a few tests injanitor/tests. You can run these with:python manage.py tests janitor## Management CommandsThere are a few managment commands avaialable to make it easier to use
django-janitor. The first isclean_allwhich will look at all of the models
that have a related Field Sanitizer, calling the models’savemethod to
trigger thepre_savesignal (which forces the fields
to be cleaned):python manage.py clean_allThis is useful if you’ve created aFieldSanitizerfor a model with
existing content.The second management command isclean_model, which works in a similar
fashion, but allows you to specify an app and a model:python manage.py clean_model myapp.MyModelFinally,list_html_elementsandlist_html_elements_for_modelexist to
help you discover what HTML tags are being used in existing content. While
these commands do require that aFieldSanitizerbe configured for existing
Models, they may be used to help you decide which tags to include in a
whitelist.You should run these commands before usingclean_allorclean_modelto
see what sort of data exists before it’s cleaned:python manage.py list_html_elementsOr:python manage.py list_html_elements_for_model myapp.MyModel
Package: django-janus
Janus is a Django project …Detailed documentation is in the “docs” directory.Quick startAdd “polls” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'janus',
]Include the polls URLconf in your project urls.py like this:url(r'^/', include('janus.urls')),Start the development server and visithttp://127.0.0.1:8000/admin/to create a poll (you’ll need the Admin app enabled).Visithttp://127.0.0.1:8000/polls/to participate in the poll.
Package: django-janyson
Store additional model fields as JSON object in PostgreSQL’sjsonbfield and work with them as regular model fields. Need new
boolean/text/foreign key/many-to-many/etc. field? Just add the decorator
with the field description to your model. It’s all! No more annoying
migrations.InstallationInstall the package usingpip installdjango-janyson.AddjanysontoINSTALLED_APPSsetting.RequirementsPython 2 or 3 (tested with 2.7+ and 3.3+)Django 1.9+ with psycopg2sixExamplefromdjango.dbimportmodelsfromjanyson.decoratorsimportadd_fieldsfromjanyson.fieldsimportJanySONFieldclassTag(models.Model):name=models.CharField(max_length=16)def__str__(self):return"[Tag:{}]".format(self.name)extra_fields={'desc':{'type':'str'},'qty':{'type':'num','default':0,'use_default':True},'avail':{'type':'nullbool','use_default':True},'main_tag':{'type':'fk','model':Tag},'tags':{'type':'m2m','model':'demo_app.Tag'},}common_options={'use_default':False,'dir_hide':True,}@add_fields(extra_fields,field_options=common_options,janyson_field='extra')classItem(models.Model):name=models.CharField(max_length=64)extra=JanySONField(verbose_name='janyson field',default=dict,blank=True,null=True)def__str__(self):return"[Item:{}]".format(self.name)>>>fromdemo_app.modelsimportTag,Item>>>Tag.objects.create(name='tag1')>>>Tag.objects.create(name='tag2')>>>item=Item(name='test')>>>item<Item:[Item:test]>>>>item.descAttributeError:'Item'objecthasnoattribute'desc'>>>item.qty0>>>print(item.avail)None>>>item.tagsAttributeError:'Item'objecthasnoattribute'tags'>>>tags=Tag.objects.all()>>>item.desc='description'>>>item.qty=100>>>item.avail=True>>>item.tags=tags>>>item.save()>>>delitem>>>item=Item.objects.get(name='test')>>>item.desc'description'>>>item.qty100>>>item.availTrue>>>item.tags[<Tag:[Tag:tag1]>,<Tag:[Tag:tag1]>,<Tag:[Tag:tag2]>]Testspython runtests.py[-dTESTDBNAME][-hHOSTNAME][-pPORT][-UUSERNAME][-PPASSWORD]Runpython runtests.py--helpfor additional info.DocumentationComing soon.
Package: django-jasmine
Master:Develop:Pull requests and issues are welcome!django-jasmine integrates theJasmine Javascript testing frameworkwithDjango.  Jasmine is a behavior-driven
development framework for testing your JavaScript code. It does not depend on
any other JavaScript frameworks.  It does not require a DOM. And it has a
clean, obvious syntax so that you can easily write tests.django-jasmine also integrates thejasmine-jqueryplugin, that
provides a set of custom matchers for jQuery framework and an API for handling
HTML fixtures in your specs.Installationpip install django-jasmineAdd ‘django_jasmine’ to your settings.INSTALLED_APPS.Add settings.JASMINE_TEST_DIRECTORY, containing the path to your javascript
jasmine test files.  Files.json should be in this directory and all test
files should be in os.path.join(settings.JASMINE_TEST_DIRECTORY, ‘spec’) *Makes sure you have properly defined a STATIC_URL.Add all Javascript files (including jQuery, and any other libraries) to
files.jsonAdd a urlconf to include(‘django_jasmine.urls’).Visit the URL you’ve included in your urlconf to display Jasmine test
results.Add a corresponding tag from the Jasmine github repo to specify a version of Jasmine to test with. Otherwise the latest tag, currently v2.4.1, is loaded.Jasmine is now loaded over cdn.rawgit.com.  A very obvious error message will appear if Jasmine isn’t loaded correctly.See the example_project directory for more information.TemplateIf you wish to modify the jasmine index template for any reason (e.g. add a new
jasmine reporter), you can create a jasmine/index.html template as follow:{% extends "jasmine/base.html" %}

{% block jasmine_preload %}
    {# If you need to do any setup before dependencies in files.json are loaded (like define app namespace) #}
{% endblock %}

{% block jasmine_extra %}
    {# If you want to extend the default jasmineEnv config #}
{% endblock %}

{% block jasmine %}
    {# If you wish to rewrite the whole html runner script #}
{% endblock %}Read templates/jasmine/base.html for the default configFixturesjasmine-jquery allowing to add fixtures, you can set them in
os.path.join(settings.JASMINE_TEST_DIRECTORY, ‘fixtures’). Then in your spec:jasmine.getFixtures().fixturesPath = "/jasmine/fixtures/";
loadFixtures("template.html")DebugIf you encounter some errors that isn’t obvious to debug, you can add
“django_jasmine” to your loggers.Integration with ./manage.py testsTo do so, I recommend usingEnvJasmine, and useFabricto run EnvJasmine after
running manage.py testsTodoKeep improving django testsAdd Growl/notifyd notificationsAdd more settings for more flexibility i.e. make a symbolic constant for cdn url.Thoroughly test fixtures and jasmine-jquery features.Improve README.Use a more specific pattern matcher for the version url.Improve error message when Jasmine fails to load over cdn.LicenseCopyright (c) 2010 Movity, Inc
Licensed new-style BSD, also containing Jasmine, which is licensed MIT. See
LICENSE file for more information.ContributingPlease see thecontributing file.
Package: django-jauth
django-jauthSimple OAuth2 authentication client library for Django and Django REST framework projects.
Django 3.0+ support. Unit test coverage 51%.FeaturesSupports simple integration both to single page apps (via postMessage) and traditional Django apps (via redirect)Does not require any JavaScript librariesThis is by no means comprehensive OAuth2 package but simple and serves single purpose.## Supported / Tested OAuth2 ProvidersFacebookGoogle## Other FeaturesSupports deauthorize and delete Facebook callbacksConfigurationsettings.JAUTH_AUTHENTICATION_SUCCESS_REDIRECT:Set this as URL of user home page after login. Set as None for single-page apps which open separate dialog for login (Value None causes postMessage to be called for the parent window with authentication result)settings.JAUTH_AUTHENTICATION_ERROR_REDIRECT:Set this as URL of login page with querystring parameter “error” as error message. Can be None for single page apps.Installpip install django-jauth
Package: django-javascript-settings
javascript-settings is a Django application that provides
a way of passing values backend from Django applications
to JavaScript in templates.InstallationPackagejavascript-settings can be installed as a normal Python package.Example instalation for pip:$ pip install django-javascript-settingsExample instalation from file:$ pip install django-javascript-settings-1.1.tar.gzConfigurationsettings.pyAdd javascript-settings to INSTALLED_APPS:INSTALLED_APPS = (
    ...
    'javascript_settings',
    ...
)Add javascript-settings.finders to STATICFILES_FINDERS:STATICFILES_FINDERS = (
    ...
    'javascript_settings.finders.JavascriptSettingsFinder',
    ...
)templateYou can use one of following ways to pass gathered data to template:Option 1: ImportAdd javascript-settings.js to script imports:<script type="text/javascript" src="{{ STATIC_URL }}javascript-settings.js"></script>Option 2: Template tagAdd javascript-settings tag to your main template:{% load javascript_settings_tags %}
<script type="text/javascript">{% javascript_settings %}</script>UsageConfiguration is defined by addingjavascript_settingsfunction to urls.py of app.javascript_settingsshould take no arguments and return json-serializable object.
Serialized object is then avaliable in Javascript asconfiguration['app_name'].If you want to placejavascript_settingsin different location, then you can
defineJAVASCRIPT_SETTINGS_SCAN_MODULESas a dictionary of'app_name': 'module_location'.ExampleTemplate:<script type="text/javascript" src="{{ STATIC_URL }}javascript-settings.js"></script>urls.py in an app “home”:def javascript_settings():
    return {
        'page_title': 'Home',
        'page_version': '1.9.20',
        'css': {
            'white': './css/white.css',
            'black': './css/black.css',
            'print': './css/print.css',
        },
        'default_css': 'white',
    }Result in file javascript-settings.js:var configuration = {'home': {'page_title': 'Home', 'page_version': '1.9.20', 'css': {'white': './css/white.css', 'black': './css/black.css', 'print': './css/print.css'}, 'default_css': 'white'}};