Saravanan666/pypi-org huggingface dataset:
Package: django-join-unrelated
django-join-unrelatedUse SQL Join with Django ORM models having no relations.If you have models in your project that share the same data but have no relations,
you might face a situation when you need to join them. But Django does not provide
this functionality yet.Withdjango-join-unrelatedyou can do the following
(models definedhere):fromapp.core.modelsimportJedi,PersonPerson.objects.create(first_name='Padme',last_name='Amidala',birth_place='Naboo')Person.objects.create(first_name='Obi-Wan',last_name='Kenobi',birth_place='Stewjon')Jedi.objects.create(first_name='Obi-Wan',last_name='Kenobi',force=100)Jedi.objects.create(first_name='Mace',last_name='Windu',force=80)Jedi.objects.join(first_name=Person.first_name).values_list('first_name')# <UnrelatedJoinQuerySet [('Obi-Wan',)]>print(Jedi.objects.join(first_name=Person.first_name).values_list('first_name').query)# SELECT "core_jedi"."first_name" FROM "core_jedi" INNER JOIN core_person ON ("core_jedi"."first_name" = core_person."first_name")# Set join type explicitlyfromdjango_join_unrelatedimportJoinTypeJedi.objects.join(first_name=Person.first_name,join_type=JoinType.FULL)# Join on multiple fieldsJedi.objects.join(first_name=Person.first_name,last_name=Person.last_name)# Join multiple modelsJedi.objects.join(first_name=Person.first_name,id=User.id)django-join-unrelatedtries to keep all QuerySet power where it is possible:Jedi.objects.join(first_name=Person.first_name).filter(last_name='Kenobi')# <UnrelatedJoinQuerySet [<Jedi: Obi-Wan Kenobi>]>Jedi.objects.join(first_name=Person.first_name).annotate(name=F('first_name'))[0].name# 'Obi-Wan'Jedi.objects.join(first_name=Person.first_name).aggregate(Sum('force'))# {'force__sum': 100}InstallationYou can installdjango-join-unrelatedusing pip:pip install django-join-unrelatedUsageJust importUnrelatedJoinManagerand set it as an attribute to your models:fromdjango.dbimportmodelsfromdjango_join_unrelatedimportUnrelatedJoinManagerclassJedi(models.Model):first_name=models.CharField('First name',max_length=128)last_name=models.CharField('Last name',max_length=128)force=models.IntegerField('Force')objects=UnrelatedJoinManager()classMeta:verbose_name='Jedi'Already implemented:filtering via joinsNot implemented yet but planned:unrelated objects selectionreturn of joined values
Package: django-jp-stations
# !!UNDER CONSTRUCTION!!# django-jp-stationsdjango-jp-stations is a simple japanese stations apps.## Quick start* Add "jp-stations" to your INSTALLED_APPS setting like this```pythonINSTALLED_APPS = [...'jp_stations',]```* Run `python manage.py migrate` to create the stations models.## Datafrom http://www.ekidata.jp
Package: django-jqchat
A chat client forDjangousing thejQuerylibrary.Try out the demoExtensibledjango-jqchat is designed to work in situations where the
chat window is not the only data to be updated by Ajax
calls. It allows extra data to be piggybacked on the
Ajax payloads; for an example, seethis demowhere a description field can be updated by the user.
Package: django-jqmobile
IntroductionjQuery Mobileis ajQuerybased library for touch/mobile web
applications.django-jqmobilebuilds on the jQuery Mobile framework to
provide easier content management with Django.django-jqmobileadds a
model for creating individually displayed screens or panels. When rendering,
the contents of the panel is inspected and other referenced panels are
rendered as well in order to combine the content and provide a more seamless
experience.PanelsThePanelmodel consists of a unique identifier, the body of the panel, and
a flag for whether the panel can be embedded or should be loaded with an
XMLHttpRequest when requested by the user.Recursive RenderingWhen rendering, the body of the panel is searched for anchor tags. Each anchor
destination is checked to see if it is a local URL. If it is a local URL, the
configurable list of panel resolvers is checked in order to see if it resolves
to a panel. If the panel can be embedded, therendermethod on the panel is
called and the results are included as a sibling in the output of the current
panel.InstallationInstall thedjango-jqmobilepackage in your preferred method: easy_install,
setup.py install, pip or buildout.Addjqmobileto the list ofINSTALLED_APPSin your settings fileIncludejqmobile.urlsin your project’s url patterns:urlpatterns = patterns('',
    (r'', include('jqmobile.urls')),
)VersionsjQuery Mobile 1.0 alpha 2jQuery 1.4.4Additional SettingsJQMOBILE_BASE_IDENTIFIERDefaultdefault. This is the identifier to use with the default URL when
using thejqmobile.urlsinclude. Requesting ‘/’ will load this panel
identifier.JQMOBILE_PANEL_RESOLVERSDefault('jqmobile.resolvers.panel_model_resolver',). A list or tuple of
panel resolving functions in the order they should be tried. Strings can be
used to specify the resolving function or the actual functions can be entered.History0.1 (2010-09-08)Panel modelOptional recursive rendering of panels (using introspection into content)Configurable panel resolvers for including panels from other products
Package: django-jqtouch
IntroductionjQTouchis ajQuerybased
library for touch/mobile web applications.django-jqtouchbuilds on jQTouch
to provide easier content management with Django.django-jqtouchadds a
model for creating individually displayed screens or panels. When rendering,
the contents of the panel is inspected and other referenced panels are
rendered as well in order to combine the content and provide a more seamless
experience.PanelsThePanelmodel consists of a unique identifier, the body of the panel, and
a flag for whether the panel can be embedded or should be loaded with an
XMLHttpRequest when requested by the user.Recursive RenderingWhen rendering, the body of the panel is searched for anchor tags. Each anchor
destination is checked to see if it is a local URL. If it is a local URL, the
configurable list of panel resolvers is checked in order to see if it resolves
to a panel. If the panel can be embedded, therendermethod on the panel is
called and the results are included as a sibling in the output of the current
panel.InstallationInstall thedjango-jqtouchpackage in your preferred method: easy_install,
setup.py install, pip or buildout.Addjqtouchto the list ofINSTALLED_APPSin your settings fileIncludejqtouch.urlsin your project’s url patterns:urlpatterns = patterns('',
    (r'', include('jqtouch.urls')),
)Additional SettingsJQTOUCH_BASE_IDENTIFIERDefaultdefault. This is the identifier to use with the default URL when
using thejqtouch.urlsinclude. Requesting ‘/’ will load this panel
identifier.JQTOUCH_PANEL_RESOLVERSDefault('jqtouch.resolvers.panel_model_resolver',). A list or tuple of
panel resolving functions in the order they should be tried. Strings can be
used to specify the resolving function or the actual functions can be entered.History0.1 (2010-09-08)Panel modelOptional recursive rendering of panels (using introspection into content)Configurable panel resolvers for including panels from other products
Package: django-jquery
RequirementsDjango1.3 or laterInstallation$ pip install django-jquerySetupJust add'django.contrib.staticfiles'and'jquery'to INSTALLED_APPS in
your settings.py:INSTALLED_APPS = (
    # ...

    'django.contrib.staticfiles',
    'jquery',

    # ...
)Refer to Djangostatic filesdocumentation to configure and deploy static files.UsageYou can refer to jquery in your template with:{{ STATIC_URL }}js/jquery.jsAdmin template customization:{% extends "admin/base_site.html" %}

{% block extrahead %}
    <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.js" />
{% endblock %}Custom widget:class MyWidget(forms.TextInput):
    class Media:
        js = ('js/jquery.js',)

    def render(self, name, value, attrs=None):
        html = super(MyWidget, self).render(name, value, attrs=attrs)
        # ...
        return html
Package: djangojr
Django Json Rest is a Django app that provides a simple way to json rest api. It is a simple and easy to use.
Python 3.0+ is required. Django 1.8+ is required.FeaturesApi viewResponseSerializerLazy responseRate limitBlacklistToken AuthenticationPermissionPaginationInstallationpip install djangojrAdddjangojr.tokenanddjangojr.ratelimitto yourINSTALLED_APPSsettingINSTALLED_APPS=('djangojr.token','djangojr.ratelimit',...)Token AuthenticationAuthorization : asdqwe5423asdqwe23asasdlike this header is required for token authentication.Examplefromdjangojr.authenticationimporttoken_authenticationfromdjangojr.permissionsimporthas_permission,has_groupfromdjangojr.pagenationimportpagenationfromdjangojr.ratelimit.utilsimportForIp,ForUser,RateTime,Blockfromdjangojr.serializerimportJsonSerializer,api_viewfromdjangojr.rate_limitimportrate_limitfromdjango.contrib.auth.modelsimportUserfromitertoolsimportchaindefmodel_to_dict(instance,fields=None,exclude=None):opts=instance._metadata=dict()forfinchain(opts.concrete_fields,opts.private_fields,opts.many_to_many):iffieldsisnotNoneandf.namenotinfields:continueifexcludeandf.nameinexclude:continueelse:data[f.name]=f.value_from_object(instance)returndataclassExampleSerializer(JsonSerializer):model=Userdefget_fields(self):fields=self.model.objects.all()# self.DATA is validated datadata,page_info=pagenation(fields,self.DATA["page"],page_size=10,start=1)data=list(map(lambdax:model_to_dict(x),data))data=dict(data=data,page_info=page_info)returnself.http_200_ok(data=data)@api_view(['POST'])# GET, POST, PUT, DELETE, PATCH@token_authentication(authentication=True)@has_permission(permissions=['add_user'])# write permission codename@has_group(groups=['admin'])# write group name# RateTime and Block support day, hour, minute, second@rate_limit(model=ForUser,rate_time=RateTime(count=10,hour=1),block=Block(active=True,minute=5))defget_fields_api(request):serializer=ExampleSerializer(data=request.body)# serializer.MODEL support str int float bool list dict set tuple and "ANY"serializer.MODEL={'name':str,"number":int,"page":int}# define api fields and typeserializer.OPTIONS={"number":[1,2,3,4]}# set options for fieldserializer.MAX_LENGTH={"name":10}# set max length for fieldserializer.UNDEFINED_FIELD=False# if True, undefined field will be ignoredifserializer.is_valid():returnserializer.get_fields()returnserializer.http_404_not_found()defexample(value,arg):...# do something@api_view(['POST'])@token_authentication(authentication=True)@rate_limit(model=ForIp,rate_time=RateTime(count=5,hour=2,minute=15),block=Block(active=True,day=1,hour=2,second=30))defget_fields_api(request):serializer=ExampleSerializer(data=request.body)serializer.MODEL={"foo":str,"numbers":list}serializer.UNDEFINED_FIELD=Trueifserializer.is_valid():serializer.lazy_response(function=example,parametes=(serializer.DATA["foo"],serializer.DATA["numbers"]),data={})returnserializer.http_404_not_found()
Package: django-jrac
RequirementsDjango1.3 or laterInstallation$ pip install django-jquerySetupAdd'django.contrib.staticfiles','jquery','jquery_ui', and'jrac'to INSTALLED_APPS in
your settings.py:INSTALLED_APPS = (
    # ...

    'django.contrib.staticfiles',
    'jquery',
    'jquery_ui'
    'jrac',

    # ...
)Make sure you use'collectstatic'to copy installed files to your static folder:$ python setup.py collectstaticRefer to Djangostatic filesdocumentation for additional information.UsageYou can refer to jquery in your template with:{{ STATIC_URL }}js/jquery.jrac.jsCustom widget:class MyWidget(forms.TextInput):
    class Media:
        js = ('js/jquery.jrac.js',)

    def render(self, name, value, attrs=None):
        html = super(MyWidget, self).render(name, value, attrs=attrs)
        # ...
        return htmlDeployment:Use the minified jquery.jrac.min.js instead of jquery.jrac.jsDemoCheck out thedemo.
Package: django-jsanctions
django-jsanctionsParses and imports sanction lists for Django projects. Supports Django 3.0+. Test coverage 69%Supported sanction lists:
* EU consolidated sanctions list
* OFAC consolidated sanctions list
* UN consolidated sanctions listData Sourceshttp://data.europa.eu/euodp/en/data/dataset/consolidated-list-of-persons-groups-and-entities-subject-to-eu-financial-sanctionshttps://home.treasury.gov/policy-issues/financial-sanctions/consolidated-sanctions-list-data-fileshttps://www.un.org/securitycouncil/content/un-sc-consolidated-listInstallpip install django-jsanctionsUnit Tests./test-coverageChanges3.6.0:
+ Added OFAC and UN list import3.5.0:
+ Refactoring3.0.0:
+ Django 3.0 support
Package: django-js-asset
UsageUse this to insert a script tag viaforms.Mediacontaining additional
attributes (such asidanddata-*for CSP-compatible data
injection.):fromjs_assetimportJSforms.Media(js=[JS("asset.js",{"id":"asset-script","data-answer":"42",}),])The rendered media tag (via{{ media.js }}or{{ media }}will
now contain a script tag as follows, without line breaks:<scripttype="text/javascript"src="/static/asset.js"data-answer="42"id="asset-script"></script>The attributes are automatically escaped. The data attributes may now be
accessed insideasset.js:varanswer=document.querySelector("#asset-script").dataset.answer;Also, because the implementation ofstaticdiffers between supported
Django versions (older do not take the presence ofdjango.contrib.staticfilesinINSTALLED_APPSinto account), ajs_asset.staticfunction is provided which does the right thing
automatically.When adding external script assets, you should passstatic=Falseto theJSobject to avoid passing the script URL throughstatic(). In this
case, you probably want to adddeferorasync, and maybe alsointegrityandcrossoriginattributes. Please note that boolean
attributes are not properly supported when using Django before 4.1 so specify
them as follows:JS("https://cdn.example.com/script.js",{"defer":"defer"},static=False,)CompatibilityAt the time of writing this app is compatible with Django 1.8 and better
(up to and including the Django master branch), but have a look at thetox configurationfor
definitive answers.
Package: djangojsendresponses
Django Jsend ResponsesJsend specified Responses for APIs.OverviewDjango Jsend Responses supply response classes to use in projects created with Django.
Seehttp://labs.omniti.com/labs/jsendfor jsend spec.RequirementsDjango (1.11, 2.0, 2.1)InstallationInstall usingpip...pip install djangojsendresponsesUsing in a codefromjsend_responsesimportSuccessResponsefromrest_framework.viewsimportAPIViewclassDriverAPIView(APIView):defget(self):driver=get_random_driver()returnSuccessResponse(object=driver)Response examplesSuccess response:{
    "status": "success",
    "data": {
        "object": { 
            "id": 1, 
            "name": "Fist object"
        }
    }
}Fail response:{
    "status" : "fail",
    "data" : {
        "name" : "A name is required" 
    }
}Error response:{
    "status" : "error",
    "message" : "A service is unavailable to connect"
}
Package: django-js-error-hook
INSTALLTo run the demo project for testing:$ git clone git://github.com/jojax/django-js-error-hook.git
$ cd django-js-error-hook
$ virtualenv env --python=python3
$ source env/bin/activate
(env) $ pip install -e .
(env) $ pip install -e demo
(env) $ demo migrateRun the server:(env) $ demo runserverThen access:http://localhost:8000/- the JavaScript error will be logged in your console.To install the project in production:$ pip install django-js-error-hookAdd django-js-error-hook to your INSTALLED_APPS settings:INSTALLED_APPS = (
    ...
    'django.contrib.staticfiles',
    'django_js_error_hook',
    ...
)If you want to log the error in the console for development:LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '\033[22;32m%(levelname)s\033[0;0m %(message)s'
        },
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
            },
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
        'javascript_error': {
            'handlers': ['mail_admins', 'console'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}By default the logger is called “javascript_error”, if you want you can defineJAVASCRIPT_ERROR_IDin your settings:JAVASCRIPT_ERROR_ID = '<your logger name>'The view will do csrf validation - if for some reason it doesn’t work, setJAVASCRIPT_ERROR_CSRF_EXEMPTtoTruein your settings.Then install the urls:urlpatterns = patterns('',
    ...
    url(r'^js_error_hook/', include('django_js_error_hook.urls')),
    ...
)In your template, simply add the js_error_hook script:<script type="text/javascript">
    window.djangoJSErrorHandlerUrl = "{% url 'js-error-handler' %}"
</script>
<script type="text/javascript" src="{% static 'js/django_js_error_hook.js' %}"></script>Now every JavaScript error will be logged in your logging error stream. (Mail, Sentry, …)Have fun and feel free to fork us and give us feedbacks!DEVELOPMENTWhen writing for this app you can runtoxwhich will test the project
against various versions of Python and Django:pip install tox
tox
Package: django-jsform
django_jsformDjango integration forjsform. In a nutshell, this package:includes jsform scripts as static filesprovides a js_response utility module for use with jsform_execresponseprovides form-rendering templates which play nicely with jsform_elementmergeprovides a suite of tests for jsformThe TestsThe tests are all integration tests, and need to be run manually.python manage.py runserver, open '/' in your browser, and follow the instructions on the test pages.Project StatusThis project is the next-generation version of some internal tools we've used on previous production Django sites, but has yet to see significant production usage.ContactIf you have any comments or questions about the project, pleasecreate an issue on the issue tracker.
Package: django-jsgettext
It is an improvement to the implementation of django gettext for javascrtipt.Features:Now parse javascript teplates for translatable strings (tested with underscore.template)New I18n view more extensible (build on top of CBV) that exposes the djangojs gettext domain
and djsgettext domain generated for translation scrings from js templates. Aditionaly the performance is
improved with caching of this view (does not supports by django view as default behavior).How it works?Djangomakemesagescommand generates a djangojs domain po file from*.jsfiles,django-jsgettextgenerates a djgettext domain po file from.htmlfiles (javascript templates) and the new view exposes
the two gettext domains to the javascript.NoteThe new view is created because the primary view of django is monolitic and not permits expose domains distinct thandjangojsanddjango.Currently, only is tested with underscore templates. Example:<div><%= gettext('sample message') %></div><div><%= ngettext('1 message', 'some messages', num) %></div><div><%= interpolate(gettext('sample %s'), [1]) %></div>How use it?Urls files:fromdjsgettext.viewsimportI18nurlpatterns=patterns('',url(r'^js-gettext/$',I18n.as_view()),)Collect messages from templates:python manage.py jsgettext_makemessages
Package: django-jsheet
Django JSheetDjango JSheet is a small tool for rendering a simple spreadsheet into a web page.By taking advantage form_class's fields the cells are set with the appropriate properties^.There is the ability to use classic excel formulas > see docs for more detailsSaving the data is done through an asynchronous method and there is the possibility of a
chronological saving of all changes.No model is required, but one can possibly be added to allow synchronization of the data with the db.^(eg IntegerField => int, TypedChoiceField => select etc)installation of the django_jsheet_assets package is required).Good luck! \o/
Package: django-jsignature3
A simple way to usejSignature jQuery pluginin yourDjangoprojects.It provides:A form field and a form widget to handle jquery plugin through a Django form;A model field to store a captured signature;A mixin adding two fields (signature / signature_date) in any of your Django models.INSTALLpip install django_jsignature3USAGEAddjsignatureto yourINSTALLED_APPS:# settings.py
INSTALLED_APPS = (
...
'jsignature',
)In a FormUse provided form field and widget:# forms.py
from django import forms
from jsignature.forms import JSignatureField

class SignatureForm(forms.Form):
    signature = JSignatureField()In your template{{ form.media }}
<form action="." method="POST">
    {% for field in form %}
        {{ field.label_tag }}
        {{ field }}
    {% endfor %}
    <input type="submit" value="Save"/>
    {% csrf_token %}
</form>Render image after form validation:# views.py
from jsignature.utils import draw_signature
from myapp.forms import SignatureForm

def my_view(request):
    form = SignatureForm(request.POST or None)
    if form.is_valid():
        signature = form.cleaned_data.get('signature')
        if signature:
            # as an image
            signature_picture = draw_signature(signature)
            # or as a file
            signature_file_path = draw_signature(signature, as_file=True)In Django Admin# models.py
from jsignature.fields import JSignatureField


class Firma(models.Model):
    firma = JSignatureField(blank=True, null=True)If you wan to store signatures, provided mixin gives asignatureand asignature_datethat update themselves:from django.db import models
from jsignature.mixins import JSignatureFieldsMixin

class JSignatureModel(JSignatureFieldsMixin):
    name = models.CharField()CUSTOMIZATIONJSignature plugin options are available in python:Globally, in your settings:# settings.py
JSIGNATURE_WIDTH = 500
JSIGNATURE_HEIGHT = 200Specifically, in your form:# forms.py
from jsignature.forms import JSignatureField
from jsignature.widgets import JSignatureWidget

JSignatureField(widget=JSignatureWidget(jsignature_attrs={'color': '#CCC'}))Available settings are:JSIGNATURE_WIDTH(width)JSIGNATURE_HEIGHT(height)JSIGNATURE_COLOR(color)JSIGNATURE_BACKGROUND_COLOR(background-color)JSIGNATURE_DECOR_COLOR(decor-color)JSIGNATURE_LINE_WIDTH(lineWidth)JSIGNATURE_UNDO_BUTTON(UndoButton)JSIGNATURE_RESET_BUTTON(ResetButton)AUTHORSFlorent Lebreton <florent.lebreton@makina-corpus.com>MANTAINERSAdremides <adremides@gmail.com>
Package: django-js-lib-ag-grid-community
AG Grid Community Repackaged for DjangoAG Grid Communitypackaged in a Django reusable app.Installationpip install django-js-lib-ag-grid-communityUsageAdd"js_lib_ag_grid_community"to yourINSTALLED_APPSsetting like this::INSTALLED_APPS = [
    ...
    "js_lib_ag_grid_community",
    ...
]In your template use:{% load static %}and one of:<script src="{% static "ag_grid_community/ag-grid-community.js" %}"></script>
<script src="{% static "ag_grid_community/ag-grid-community.min.js" %}"></script>
<script src="{% static "ag_grid_community/ag-grid-community.noStyle.js" %}"></script>
<script src="{% static "ag_grid_community/ag-grid-community.min.noStyle.js" %}"></script>
Package: django-js-lib-bootstrap5
Bootstrap5 Repackaged for DjangoBootstrap5packaged in a Django reusable app.This package includes only the original JS and CSS files.Installationpip install django-js-lib-bootstrap5UsageAdd"js_lib_bootstrap5"to yourINSTALLED_APPSsetting like this::INSTALLED_APPS = [
    ...
    "js_lib_bootstrap5",
    ...
]In your template use:{% load static %}...<link rel="stylesheet" href="{% static "js-lib-bootstrap5/css/bootstrap.css" %}">...<script src="{% static "js-lib-bootstrap5/js/bootstrap.js" %}"></script>