Saravanan666/pypi-org huggingface dataset:
Package: django-js-lib-bootstrap-icons
Bootstrap Icons Repackaged for DjangoBootstrap Iconspackaged in a Django reusable app.Installationpip install django-js-lib-bootstrap-iconsUsageAdd"js_lib_bootstrap_icons"to yourINSTALLED_APPSsetting like this::INSTALLED_APPS = [
    ...
    "js_lib_bootstrap_icons",
    ...
]In your template use:{% load static %}...<link rel="stylesheet" href="{% static "bootstrap-icons/css/font/bootstrap-icons.min.css">" %}">or<link rel="stylesheet" href="{% static "bootstrap-icons/css/font/bootstrap-icons.css">" %}">
Package: django-js-lib-htmx
HTMX Repackaged for DjangoHTMXpackaged in a Django reusable app.Installationpip install django-js-lib-htmxUsageAdd"js_lib_htmx"to yourINSTALLED_APPSsetting like this::INSTALLED_APPS = [
    ...
    "js_lib_htmx",
    ...
]In your template use:{% load static %}And one of:<script src="{% static "htmx/htmx.js" %}"></script>
<script src="{% static "htmx/htmx.min.js" %}"></script>
Package: django-js-lib-tabulator
Tabulator Repackaged for DjangoTabulatorpackaged in a Django reusable app.Installationpip install django-js-lib-tabulatorUsageAdd"js_lib_tabulator"to yourINSTALLED_APPSsetting like this::INSTALLED_APPS = [
    ...
    "js_lib_tabulator",
    ...
]In your template use:{% load static %}...<link rel="stylesheet" href="{% static "tabulator/css/tabulator.css" %}">...<script src="{% static "tabulator/js/tabulator.js" %}"></script>
Package: django-js-logger
This is a very simple Django app for forwarding console logs and console errors to dedicated Django loggers.Useful for catching Javascript errors that are not logged by Django natively and would otherwise only be logged to the client’s console. Can be particularly useful if you have JavaScript running on top of our server-side rendered views.The app works by postingall relevant eventsto an internal Django API, which logs them to one of two loggers. Not sure what impact this has on an apps performance, but it likely should not run anywhere near performance-sensitive production environments. Primarily this is intended to be a debugging aid.A flowchart of the app’s structure looks something like this:The package is open to contributions.InstallationInstalling with pip:pip install django-js-loggerInstalling with poetry:poetry add django-js-loggerQuick startAdddjango_js_loggerto your INSTALLED_APPS settings:INSTALLED_APPS = [
    ...
    'django_js_logger',
]Include the packages URLconf in your project urls.py like this:path('js-logs/', include('django_js_logger.urls')),Optionally, specify your logging preferences by addingJS_LOGGERto your settings:JS_LOGGER = {
    'CONSOLE_LOG_LEVEL': 'INFO',
    'CONSOLE_ERROR_LEVEL': 'WARNING'
}Add the required static file to your project by runningmanage.py collectstatic. This should add a folder,django_js_loggerwith the filelogger.js. If this is not the case, you can copy the file manually from the demo project above.Importlogger.jsin the views you wish to log from by adding a JS import to your templates:<script src="static/django_js_logger/logger.js"></script>
Package: django-jsnlog
A django integration for client side logging for javascript with JSNLoghttps://jsnlog.com/.DocumentationThe full documentation is athttps://django-jsnlog.readthedocs.io.QuickstartInstall django-jsnlog:pip install django-jsnlogAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'jsnlog',...)Add django-jsnlog’s URL patterns:urlpatterns+=[path(r'jsnlog.logger',include('jsnlog.urls')),]Add django-jsnlog’s javascript files to your template:...<scripttype="text/javascript"src="{% static 'jsnlog/js/jsnlog.min.js' %}"></script><scripttype="text/javascript"src="{% static 'jsnlog/js/django-jsnlog.js' %}"></script>...CreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.3.0 (2023-11-02)change status code from 200 to 2040.2.0 (2021-04-14)Second release on PyPI.clean up the code0.1.0 (2021-04-14)First release on PyPI.
Package: django-json-404-middleware
# django-json-404-middlewareDJango middleware that returns 404s as JSON instead of default html responseWhen using Django for a restuful API, for example with DRF, it makes sense to return errors as JSON, which is what happens with 400s, 403s, etc. since they are generated by DRF themselves i.e `serializer.is_valid(raise_exception=True)` This however is not the case with 404s.This middleware remedies this problem by intercepting 404 responses and turning them into JSON responses.Please note that middleware [changed in django 1.10](https://docs.djangoproject.com/en/1.10/topics/http/middleware/) and thus this pacakge requires django version >= 1.10.```pythonMIDDLEWARE = [# Should come after any django middleware such as CommonMiddleware'django_json_404_middleware.JSON404Middleware',]```# Installation`pip install django-json-404-middleware`
Package: django-jsonapi
##### v1.0.0Django JSON API Made Simple===========================No more forcing your JSON to be bound to models.This is a JSON api framework, the way it should be.- Simple- Flexible / Dynamic- UsefulThe API framework uses Django Forms, so no more bull trying to validate input a certain way.# !!! Get to the code !!!How about this?First: `pip install django-jsonapi`, ok now:```language=pythonfrom djsonapi import api, serial@serial.serializer(User, mode="current_user")def current_user_serializer(obj):return serial.serialize_model(obj, fields=("name", "email", "last_login", "date_joined"))@serial.serializer(User, mode="public")def public_user_serializer(obj):return serial.serialize_model(obj, fields=("name", "date_joined"))@csrf_exempt@api.login_required@api.require_method("GET", "POST") # passes post/put down, 405's if method is incorrect@api.post_form(forms.UserUpdateForm) # validates post/put data with formdef profile(request, form):if form:# form is guaranteed to be valid hereuser = form.save()else:user = request.userdata = serial.serialize(user, mode="current_user")return api.ok(message="Hello World!", user=user)```The response could look like:```{"message": "Hello World!","body": {"name": "Evan Leis","last_login": "2014-04-09T22:48:21.957Z","date_joined": "2014-04-09T22:47:08.153Z","email": "foo@example.com",},"ok": true}```For more code, see the example app.**Important: make sure your serializers get loaded.**Easiest way to do this is put them in a file called serial.py and in your app's `__init__.py`, load via```## myproj.myapp.__init__.pyfrom myproj.myapp.serial import *```## `djsonapi.serial`Methods for serializing objects into dicts, and dicts into JSON.## `djsonapi.api`Methods for returning HttpResponses with JSON data.License----The MIT License (MIT)Copyright (c) 2014 Evan LeisPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.
Package: django-jsonb-schema
# Django JSON Schema[![Build Status](https://travis-ci.org/m19t12/django-json-schema.svg?branch=master)](https://travis-ci.org/m19t12/django-json-schema)[![Coverage Status](https://coveralls.io/repos/github/m19t12/django-json-schema/badge.svg?branch=master)](https://coveralls.io/github/m19t12/django-json-schema?branch=master)Django JSON Schema Field.## Table of content- [Introduction](#introduction)- [Installing](#installing)- [Usage](#usage)- [TODO](#TODO)## IntroductionDjango JSON Schema is a library for displaying and validatingpostgresql jsonb data.## Installing```pip install django_jsonb_schema```## UsageFirst you create a schema class.Schema class is a django abstract model class (abstract = True).You can import SchemaMeta class or create an abstract class.If you want to validate and display nested data you can do this with the SchemaForeignKey.For example to validating this dict data.```python{'name': 'parent','age': 50,'son': {'name': 'son','age': '15','school': {'name': 'school','address': 'school address'}}}```We create this three schema classes.We can use any django model or third party field.```python#schemas.pyfrom json_schema.models import SchemaForeignKey, SchemaMetaclass SchoolSchema(models.Model):name = models.CharField(max_length=128)address = models.CharField(max_length=128)Meta = SchemaMeta()class SonSchema(models.Model):name = models.CharField(max_length=128)age = models.IntegerField()school = SchemaForeignKey(SchoolSchema, on_delete=models.CASCADE)Meta = SchemaMeta()class ParentSchema(models.Model):name = models.CharField(max_length=128, default="test")age = models.IntegerField()son = SchemaForeignKey(SonSchema, on_delete=models.CASCADE)Meta = SchemaMeta()```After we create our model.```python#models.pyfrom django.db import modelsfrom json_schema.fields import JSONSchemaFieldfrom .schemas import ParentSchemaclass JSONSchemaModel(models.Model):simple_text = models.CharField(blank=True, null=True, max_length=256)simple_int = models.IntegerField(blank=True, null=True)parent = JSONSchemaField(schema=ParentSchema, blank=True)```## TODOSupport array elements.
Package: django-json-convertible-models
JSON Convertible Model is a Django app to replace models.Model and make it possible that models will
be able to return JSON-Objects directly without creating an new serializer class object.
It will not replace the awesome Django-Restframework package but sometimes it is to much afford for me.
Detailed documentation is in the “docs” directory.Quick startAdd “convertable_model” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'convertable_model',
]Create your own models and choose “JSONConvertibleModel” as class to inherit from:class FooModel(JSONConvertibleModel):
    ...2.1. Define which fields you want to use:class FooModel(JSONConvertibleModel):
    ...

    json_fields = '__all__'

or

class FooModel(JSONConvertibleModel):
    ...

    json_fields = ('field1', 'field2', )2.2. Define the JSON-Key’s if you want to give them a different name:class FooModel(JSONConvertibleModel):
    ...

    @jsonify_me
    def json_aliases(self):
        return {
            'foo1': 'IntegerField',
            'foo2': 'My_name'
        }2.3 If you want to change the return value of the field:class FooModel(JSONConvertibleModel):
    ...

    @jsonify_me
    def prefix_foobar2(self):
    # import is the decorator and that the field name is written in "{foo}_{attribute}"
        return self.foobar2.upper()
Package: django-json-dbindex
Describe your database index in json files into your appsDetailed documentation is in the “docs” directory.Quick startAdd “json_dbindex” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'json_dbindex',
)Runpython manage.py list_jsindexto list all defined indexes.Create indexesCreate a file in you app directory calleddbindex_create.jsonwith
following contents[{“name”: “django_site_composite_idx”,“table”: “django_site”,“columns”: [“domain”,”name”],“predicat”: “WHERE id > 1000”,“using”: “btree”,“database”: “default”,“unique”: yes},{“name”: “django_site_name_idx”,“table”: “django_site”,“columns”: [{“name”: “gist_trgm_ops”}],“using”: “gist”,“extension”: “pg_trgm”}]Trying to create an existing index will not generate an error, only a
logging at level notice will be raised.Drop indexesCreate a file in you app directory calleddbindex_drop.jsonwith
following contents.[{“name”: “django_site_composite_idx”},{“name”: “django_site_domain_idx”}]Only the name is required. In the above example two indexes will be
dropped. Trying to drop a non existing index will not generate an
error, only a logging at level notice will be raised.
Package: django-jsoneditor
Django-JSONEditor is an online structured JSON input widget for Django appropriate for various JSONField’s provided for Django.Code of the javascript JSONEditor online editor has been got from thehttp://jsoneditoronline.org/.See the latest versions of the javascript online JSON Editor here:https://github.com/josdejong/jsoneditorSample views:InstallationLatest version from the GIT repository:pip install "git+git://github.com/nnseva/django-jsoneditor.git"Stable version from the PyPi repository:pip install django-jsoneditorSee all details onhttps://github.com/nnseva/django-jsoneditor
Package: django-json-editor
A powerful jsonDocumentationThe full documentation is athttps://django-json-editor.readthedocs.org.QuickstartInstall django-json-editor:pip install django-json-editorThen use it in a project:import djjsoneditorFeaturesTODOCookiecutter Tools Used in Making This Packagecookiecuttercookiecutter-djangopackageHistory0.1.0 (2015-01-01)First release on PyPI.
Package: django-jsoneditor-widget
django-jsoneditor-widgetDjango form widget form JSONFieldDemoIt look like this.InstallInstall:pip install django-jsoneditor-widgetSettings:INSTALLED_APPS=[# some apps ....'jsoneditor',# other apps ...]Create modelfromdjango.dbimportmodelsfromdjango.contrib.postgres.fieldsimportJSONFieldclassBook(models.Model):name=models.CharField(max_length=150)information=JSONField()def__str__(self):returnself.nameAdmin site settingsUse ModelAdminfromdjango.contribimportadminfromjsoneditor.adminimportJSONFieldModelAdminfrom.modelsimportBookadmin.site.register(Product,JSONFieldModelAdmin)Use mixinfromdjango.contribimportadminfromjsoneditor.adminimportJSONFieldAdminMixinfrom.modelsimportBook@admin.register(Book)classBookModelAdmin(JSONFieldAdminMixin,admin.ModelAdmin):passUse custom widget to specify jsoneditor optionsfromdjango.contribimportadminfromdjango.contrib.postgres.fieldsimportJSONFieldfromjsoneditor.formsimportJSONEditorfrom.modelsimportBookclassTextJSONEditor(JSONEditor):jsoneditor_options={"mode":"text"}@admin.register(Book)classBookModelAdmin(admin.ModelAdmin):formfield_overrides={JSONField:{"widget":TextJSONEditor}}
Package: django-json-error-response
Django Error Response In Jsondjango_json_error_response is ready to use library for django to show response in customized JsonResponse.New Features!Easy to use response than generic JsonResopnse.Support django-3+ version (Self Tested)You can also:Contribute (https://github.com/subodh358/django_status_response)Use:fromdjango_json_error_response.httpimport(Http400Response,Http403Response,Http404Response,Http500Response,SuccessResponse,ErrorResponse)#code linesdefmy_view(request):ifmy_condition:#your codereturnSuccessResponse(message=my_message)#default status is 200 for this responseelse:returnErrorResponse(message=my_message,status=status_code)#status_code can be anything that you want to respond with.defmy_custom_view(request):ifcondition:#your codereturnSuccessResponse(message=my_message)else:Http404Response(message=my_message)For ErrorResponse()ErrorResponse take two arguments
~ message
~ status (for error except 404,403,400,500)Exra informationYou can also pass json data insted of message or both at same time in every Resonse.LicenseMITFree Software, Hell Yeah!
Package: django-jsonfallback
This is an extension todjango.contrib.postgres.fields.JSONField, that works on other
databases than PostgreSQL.OnMySQLandMariaDB, it uses the native JSON data type and supports most features.OnSQLiteand all other databases, it just stores JSON strings in a text field and does not support querying.This is tested against:Python 3.4 to 3.6Django 2.0 to 2.1MySQL 5.7MariaDB 10.3PostgreSQL 9.4SQLite (no querying funcationality)UsageJust use our drop-in replacement for JSONField:from django.db import models
from jsonfallback.fields import FallbackJSONField


class Book(models.Model):
    data = FallbackJSONField()

    def __str__(self):
        return str(self.data['title'])LicenseThe code in this repository is published under the terms of the Apache License.
See the LICENSE file for the complete license text.This project is maintained by Raphael Michel <mail@raphaelmichel.de>. See the
AUTHORS file for a list of all the awesome folks who contributed to this project.
Package: django-jsonfeed
This library intends to supportJSON FeedinDjangoandfeedgenerator.UsageIf you are using Django:fromdjango.contrib.syndication.viewsimportFeedfromjsonfeedimportJSONFeedclassExampleFeed(Feed):type=JSONFeedIf you are using this library without Django, you will first need to install thefeedgeneratorPython package:fromjsonfeedimportJSONFeedfeed=JSONFeed(title='Hello, World!',link='https://example.com/',language='en')feed.add_item(title='One',link='https://example.com/1/',pubdate=datetime(2018,2,28,15,16))returnfeed.writeString()Installation$ pip install django-jsonfeed
Package: django-json-field
django-json-fieldcontains a flexible JSONField and associated form field. The model field is not only capable of serializing common JSON data types (int, float, decimal, string, time, date, datetime, etc.) but also lazily deserializing them so they can be accessed and modified as normal Python objects within Django.A form field is also provided. It will accept serialized representations:{"date":"2012-04-23T19:16:54.133","num": "1.2399"}And also provides safe access to thedatetimemodule for explicit use:{"date": datetime.datetime(2012, 4, 23, 19, 16, 54, 133000)}While the JSON string will not be deserialized until it is accessed it can still be a performance concern, so you may find it valuable to disable the custom deserializer (JSONField(decoder=None)).django-json-fieldis also compatible with South and Python 3.InstallationInstall from PyPI:pip installdjango-json-fieldIf installing manually, first install the dependencies:pip installpython-dateutilsixInstall from GitHub:git clonegit://github.com/derek-schaefer/django-json-field.gitpip install-egit+git://github.com/derek-schaefer/django-json-field.git#egg=json_fieldConfigurationAddjson_fieldto yourPYTHONPATHandINSTALLED_APPSsetting:INSTALLED_APPS = (
    ...
    'json_field',
    ...
)That’s all!UsageAdd aJSONFieldto your model like any other field.from json_field import JSONField
from django.db import models

class MyModel(models.Model):

    json = JSONField()JSONFieldalso has a few additional optional parameters.default: Falls back on"null"if not provided andnull=False, otherwiseNonedb_type: Allows you to specify the column type (default:text)lazy: Defer deserialization until the field is directly accessed (default:True)encoder: Custom JSON encoder (default:DjangoJSONEncoder)decoder: Custom JSON decoder (default:json_field.fields.JSONDecoder)encoder_kwargs: Specify all arguments to the encoder (overridesencoder)decoder_kwargs: Specify all arguments to the decoder (overridesdecoder)evaluate_formfield: Evaluate (risky) and enable use of thedatetimemodule in the form field (default:False)Licensedjango-json-fieldis licensed under the New BSD license.
Package: django-jsonfield2
Django-JSONField2===================``django-json-field2`` is a flexible quering JSONField and associated form fieldIt is a compilation and adaptation of the following projects* https://bitbucket.org/schinckel/django-jsonfield* https://github.com/derek-schaefer/django-json-field* https://github.com/bradjasper/django-jsonfield* https://github.com/certae/django-softmachine/blob/master/src/protoLib/fields.py* https://github.com/frol/django-quering-jsonfield* http://cramer.io/2009/04/14/cleaning-up-with-json-and-sql/* http://natebeacham.com/blog/nate-beacham/31/Feature	Description-------------------South supportForm fieldForm widgetModel fieldPython3 support``django-jsonfield2`` is also compatible with South, Django 1.8 and Python 3.Installation------------Install from PyPI:``pip install django-jsonfield2``Source:-------``git clone git://github.com/DarioGT/django-jsonfield2.git``Configuration-------------Add ``jsonfield2`` to your ``PYTHONPATH`` and ``INSTALLED_APPS`` setting:::INSTALLED_APPS = (...'jsonfield2',...)::Usage-----::from django.db import modelsfrom jsonfield2 import JSONField, JSONAwareManagerclass JsonModel(models.Model):code = models.CharField( blank=False, null=False, max_length=20 )status = models.CharField( blank=True, null=True, max_length=20 )info = JSONField(default={})objects = JSONAwareManager(json_fields = ['info'])def __str__(self):return self.codeJson Query----------::...obj = Person.objects.create(name = "Bill")obj.info = {'sex': 'male','address': {'country', 'Canada',}}obj.save()Person.objects.filter(info__address__country = 'Canada')>>> [Person: "Bill"]Usage-----Now, it will validate the JSON on entry, and store it as a text in the database.  When you instantiate/fetch the object, it will be turned back into a python list/dict/string.jsonify templatetag-------------------This allows you to convert a python data structure into JSON within a template::{% load jsonify %}<script>var foo = {{ bar|jsonify }};</script>Tests----------``python runtest.py``Todo----------Allow order_by when json criteria are usedLicense-------``django-jsonfield2`` is licensed under the New BSD license.
Package: django-jsonfield-compat
django-jsonfield-compat=======================![Travis Build Status](https://travis-ci.org/kbussell/django-jsonfield-compat.svg?branch=master)[![Coverage Status](https://coveralls.io/repos/github/kbussell/django-jsonfield-compat/badge.svg?branch=master)](https://coveralls.io/github/kbussell/django-jsonfield-compat?branch=master)Django 1.9 introduced first-class support for Postgresql's json type.Not everyone uses Postgresql, nor has upgraded to 1.9 yet, so a mixed ecosystem exists.Unfortunately, these two field types cannot be used together in the same project.django-jsonfield-compat was created to be able to allow 3rd-party libraries to work in both worlds.Requires Django >= 1.8Installation------------`pip install django-jsonfield-compat`Adjust all instances of importing `JSONField` and `JSONFormField` to `jsonfield_compat`'s definition (including all migration files!)```from jsonfield_compat import JSONFieldfrom jsonfield_compat.forms import JSONFormField```Register your app from the AppConfig class's `ready()` function.Example `apps.py`:```from __future__ import unicode_literalsfrom django.apps import AppConfigclass MyAppConfig(AppConfig):name = 'myapp'verbose_name = "My App"def ready(self):import jsonfield_compatjsonfield_compat.register_app(self)```Now, when users of your application want to switch from using `django-jsonfield`'s implementationto Django's native `JSONField`, they add the setting:```USE_NATIVE_JSONFIELD = True```And then run migrations to convert the app's DB tables to use the JSON column type.License-------django-jsonfield-compat is licensed under the MIT license (see the `LICENSE` file for details).