Saravanan666/pypi-org huggingface dataset:
Package: django-html
===========django_html===========This package represents an experimental approach to improving the way Djangooutputs form widgets. At the moment, widgets created using `django.forms` areoutputted as XHTML (with self closing `/>` tags) even if the rest of your siteuses HTML. This package solves this problem by introducing three new templatetags: `{% doctype %}`, `{% field %}` and `{% slash %}`.To install, place the `django_html` directory somewhere on your python path,then add `django_html` to `INSTALLED_APPS` in your `settings.py` file.See the following thread on django-developers for further backgroundinformation:http://groups.google.com/group/django-developers/browse_thread/thread/5f3694b8a19fb9a1/{% doctype %}=============The doctype tag does two things: it outputs the relevant doctype and it storesyour chosen doctype in `context._doctype`. Example usage::{% load html %}{% doctype "html4" %}This will output::<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">It will also set the context's doctype to "html4". Other template tags canthen take that in to account when deciding how they should render.If you just want to set the doctype without outputting it to the page you canuse the optional "silent" argument::{% doctype "html4" silent %}{% field %}===========The field tag allows you to output `django.forms` widgets taking the currentactive doctype in to account. Django outputs XHTML form widgets by default butthis may not be appropriate if your site uses HTML 4. Here's how you output aform widget with stock Django::<label for="id_name">Name:</label> {{ form.name }}This will always output as XHTML. Here's how you use the new `{% field %}`tag::<label for="id_name">Name:</label> {% field form.name %}Now the current doctype (as set using the {% doctype %} tag) will be used todecide if XHTML self-closing tags should be used by the widget.The field tag also lets you specify extra HTML attributes for a form fieldfrom within your template (useful for adding things like extra classes withouthaving to modify the form definition in your Python code)::<label for="id_name">Name:</label> {% field form.name class="myclass" %}With an HTML doctype, this will render as::<input type="text" name="name" id="id_name" class="myclass">If your doctype is XHTML, you will get::<input type="text" name="name" id="id_name" class="myclass" />{% slash %}===========This tag is included for completeness. Authors of reusable apps which shipwith their own templates (extending base.html) might want to ensure that theirapps use the correct markup for the current doctype. In practise, this meansoutputting a self-closing tag for a small number of HTML elements. The`{% slash %}` tag simply outputs the string " /" for an XHTML doctype andrenders blank for an HTML doctype. Here are some examples::<br{% slash %}><img src="/site/logo.png" alt="My site"{% slash %}>
Package: django-html5accordion
django-html5accordion adds JS support to expand/collapse any content, like
HTML5 details/summary elements. It can be called on any element, and accepts
options to set the selector for thesummarycontents that should always
remain visible (and act as the link to expand/collapse the hidden content),
the speed of the slideUp/Down animation, the class to be added when thedetailselement is expanded, selectors for elements withinsummarythat should not trigger the expand/collapse, and callback fns.DependenciesjQuerylibraryInstallationIn your Django project settings, add “html5accordion” to your INSTALLED_APPS.UsageLinking the JS:<script src="{{ STATIC_URL }}html5accordion/jquery.html5accordion.js"></script>Sample HTML:<article class="details">
  <header class="summary">
    <p>This content will always be visible</p>
  </header>
  <div>
    <p>This content will expand/collapse when `.summary` is clicked</p>
  </div>
</article>Calling the plugin:$('.details').html5accordion();Calling the plugin with a variety of options explicitly configured to their
default values:$('.details').html5accordion({
  summarySelector: '.summary',                // Selector for summary text
  slideSpeed: 200,                            // Slide animation speed (ms)
  expandedClass: 'open',                      // Class added when details are
                                                // expanded
  ignoredElements: 'button, a, input, label', // Elements within `summary` that
                                                // will not trigger expand/collapse
  initialSlideSpeed: null,                    // Slide animation speed (ms) for
                                                // already-expanded details
  openCallback: null,                         // Callback fn after open animation
  closeCallback: null                         // Callback fn after close animation
});Note: To expand adetailselement on initial load, simply add classopen(or whatever class is passed as optionexpandedClass), or add
attributeopen.
Package: django-html5-appcache
Application to manage HTML5 Appcache Manifest files for dynamic Django web applications.While handy and quite simple in its structure, manifest file is quite burdensome
to keep up-to-date on dynamic websites.django-html5-appcachetry to make this effortless, exploiting the batteries
included in Django to discover pages and assets as they are updated by the users.While still in pre-alpha state it should be usable, at least for testing purposes.Documentation is in progress.As generating manifest file can be quite resource intensive for larger sites,
it uses the Django cache system.Requirementsdjango>=1.4lxmlhtml5libInstallationTo get started usingdjango-html5-appcacheinstall it withpip:$ pip install django-html5-appcacheIf you want to use the development version install from github:$ pip install git+https://github.com/nephila/django-html5-appcache.git#egg=django-html5-appcacheSeeDocumentationfor further details.
Package: django-html5croppingtools
Installationrun  pip install django-html5croppingtoolsConfigure settings.pyAdd html5croppingtools to INSTALLED_APPSmanage.pyrun manage.py collectstaticExamplesAdmin example without saving original image#models.pyclassMyModel(models.Model):...image=models.ImageField(upload_to='<upload path>')...#admin.py....fromhtml5croppingtools.fieldsimportCropImageFieldfromhtml5croppingtools.formsimportCropImageFormMixin....classMyModelForm(CropImageFormMixin,ModelForm):"""
    :param max_size maximum size of image width or height(depends on which is greater) in pixels
    :param width_ratio and height_ratio using this two parameters code calculates ratio
           between width and height of image and helps when selecting cropping area in admin by fixing ratio between sides
    """image=CropImageField(max_size=900,width_ratio=500,height_ratio=300)....@admin.register(MyModel)classMyModelAdmin(admin.ModelAdmin):form=MyModel....Admin example with saving original image...classMyModel(models.Model):...image=models.ImageField(upload_to='<upload path>')original_image=models.ImageField(upload_to='<upload path>')......classMyModelForm(CropImageFormMixin,ModelForm):"""
    :param original_field name of corresponding model's field where you want to save original image
    """image=CropImageField(original_field='original_image',max_size=900,width_ratio=500,height_ratio=300,)....On the fly croppingAdd html5croppingtools.imagecrop.ImageCropMiddleware to MIDDLEWARE_CLASSESafter adding html5croppingtools.imagecrop.ImageCropMiddleware to MIDDLEWARE_CLASSES
you can add "quality=<int>&dimensions=<int x0 >x<int y0 >x<int x1 >x<int y1>" this parameters to GET querystring
and middleware will serve corresponding image cropped and resizedMiddleware working steps:If “quality” is supplied, image will be resizedIf crop “dimensions” are supplied, image will be croppedreturn imageNote:“dimensions” and “quality” parameters are optionalExample/media/image/my_image_guid.jpeg?quality=1200&dimensions=300x200x900x800middleware will resize image proportionally making It’s bigger side
equal to 1200 pixelsafter shrinking it will crop x1=300 y1=200 x2=900 y2=800 rectanglereturn imageTemplate example{% load croppingtools_extra %}<imgsrc="{% html5crop MyModel.image dimensions='100x100x300x300' quality=500 %}">takes “ImageFiled”, “dimensions” and “quality” parameters and returns url “/media/image/my_image_guid.jpeg?quality=500&dimensions=100x100x300x300” after which middleware will serve cropped and resized imageNote: “dimensions” and “quality” parameters are optional
Package: django_html_assertions
Html assertions is a simple django testing mixin that makes it possible to assert that a given block of html contains a tag (optionally with a given class) that also contains the specified textual content.pip install django_html_assertionsUsageTo use the new test assertion methods all you need to do is mix the mixin into your test suite.  You’re then ready to go.from django.test import TestCase

from django_html_assertions.mixins import HTMLContainsMixin


TEST_HTML = """
<html>
    <body>
        <p class="odd">Item 1</p>
        <p class="even">Item 2</p>
        <p class="odd">Item 3</p>
    </body>
</html>
"""


class HTMLContainsMixinTestCase(HTMLContainsMixin, TestCase):
    """
    Tests the test class mixin
    """
    def test_assert_html_tag_contains_valid(self):
        """
        The method should not raise an exception
        """
        self.assertHTMLTagContains(
            TEST_HTML,
            'Item 1',
            'p'
        )

    def test_assert_html_tag_contains_valid_with_class(self):
        """
        The method should not raise an exception
        """
        self.assertHTMLTagContains(
            TEST_HTML,
            'Item 1',
            'p',
            tag_class='odd'
        )

    def test_assert_html_tag_contains_invalid(self):
        """
        The method should raise an exception
        """
        with self.assertRaises(AssertionError):
            self.assertHTMLTagContains(
                TEST_HTML,
                'Item 10',
                'p'
            )

    def test_assert_html_tag_contains_invalid_with_class(self):
        """
        The method should not raise an exception
        """
        with self.assertRaises(AssertionError):
            self.assertHTMLTagContains(
                TEST_HTML,
                'Item 1',
                'p',
                tag_class='even'
            )

    def test_assert_html_tag_not_contains_valid(self):
        """
        The method should not raise an exception
        """
        self.assertHTMLTagNotContains(
            TEST_HTML,
            'Item 10',
            'p'
        )

    def test_assert_html_tag_not_contains_valid_with_class(self):
        """
        The method should not raise an exception
        """
        self.assertHTMLTagNotContains(
            TEST_HTML,
            'Item 1',
            'p',
            tag_class='even'
        )

    def test_assert_html_tag_not_contains_invalid(self):
        """
        The method should raise an exception
        """
        with self.assertRaises(AssertionError):
            self.assertHTMLTagNotContains(
                TEST_HTML,
                'Item 1',
                'p'
            )

    def test_assert_html_tag_not_contains_invalid_with_class(self):
        """
        The method should not raise an exception
        """
        with self.assertRaises(AssertionError):
            self.assertHTMLTagNotContains(
                TEST_HTML,
                'Item 1',
                'p',
                tag_class='odd'
            )
Package: django-html-cleaner
Django text and character fields that clean HTML input.QuickstartInstall django-html-cleaner:pipinstalldjango-html-cleanerThen enable it in a Django project by addingdjango_html_cleanerto
yourINSTALLED_APPSin your Django settings.Then use it:fromdjango_html_cleaner.modelsimportSanitizedTextField# in a Django modelfield=SanitizedTextField()DocumentationThe full documentation is athttps://django-html-cleaner.readthedocs.org.
Package: django-html-dumper
Dumps html pages and their corresponding assets into a tar fileDocumentationThe full documentation is athttps://django-html-dumper.readthedocs.io.QuickstartInstall HTML dumper:pip install django-html-dumperAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'html_dumper.apps.HtmlDumperConfig',...)FeaturesAdd a django commanddump_htmlpython manage.py dump_html [path/to/my/page1 my/page2] (default to ['/', ])This will create a directoryHTML_OUTPUT(name can be customized viasettings.SITE_OUTPUT_DIRECTORY) which will contain :the content of the page under the given urls for all available languagesthe static folder (copied from the output ofcollectstatic, beware of all the admin assets…)Running TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.2.5 (2017-08-14)First usable (ish) version0.1.0 (2017-08-14)First release on PyPI.
Package: django-html-emailtemplates
Django HTML Email TemplatesA Django app for allowing users to create html emails using Django template variables
passed in to the context.InstallationUse the package managerpipto install django-html-emailtemplates.pip install django-html-emailtemplatesAdd the package to your INSTALLED_APPSINSTALLED_APPS = [
    ...
    'emailtemplates',
    ...
]Usage# models.py
from emailtemplates.fields import EmailTemplateField
class Settings(models.Model):
    contact_form_reply = EmailTemplateField(
        models.SET_NULL,
        null=True,
        email_context="""
        You can use the following variables in the template:
        {{ name }}
        {{ subject_matter }}
        {% for item in items %}
            Possible values are:
            {{ item.title }}
            {{ item.cost }}
            {{ item.description }}
        {% endfor %}
        """
    )

# views.py
from emailtemplates.utils import send_email_template
from emailtemplates.models import EmailTemplate
from .models import Settings

# view definition
def form_valid(self, form):
    enquiry = form.save()
    # send reply email to website user
    send_email_template(
        Settings.objects.first().contact_form_reply,
        [enquiry.email],
        {
            'name': enquiry.name,
            'subject_matter': enquiry.subject,
            'items': [
                {
                    'title': 'Product',
                    'cost': '&pound;20.00',
                    'description': 'Product description...'
                }
            ]
        }
    )
    # send notification to website owner
    send_email_template(
        EmailTemplate(
            subject='Enquiry from example.com',
            content='''<div>
                <p>There was an enquiry on your website, the details are below:</p>
                <table>
                    <tbody>
                        <tr>
                            <td>Name:</td>
                            <td>{{ enquiry.name }}</td>
                        </tr>
                    </tbody>
                </table>
            </div>'''
        ),
        ['contact@example.com'],
        {
            'enquiry': enquiry
        }
    )Features to addAdd custom ForeignKey field to display the context that can be usedAdd base email header/footerAdd plugins for images/documentsAdd better html fieldAdd support for Wagtail StreamField
Package: django-htmx-datatables
django-data-tableRender a data table with Django and htmx.!! This Django app is currently in development and not yet ready for production use !!ContentsFeaturesScreenshotsComparison with DataTables JSHow To UseLive exampleChange LogFeaturesFundamentalsRenders a data table widget on a webpageThe widget is updated by user actions (e.g. next page) without page reloadsAll data is processed server sideUIUser can navigate pagesUser can order by columnsUser can change how many entries are shownUser can do an active text searchUser can apply filters to the entries.Developer featuresCan show data from model field, a calculated DB field or calculated by Python functionCustom header labelsCustom formatter can be applies for each column (e.g. numeric)Optional generated totals footerSupports CSS styling of table via stable HTML table IDStyled using Bootstrap 3 & Font Awesome 5ScreenshotsHere is an example:Comparison with DataTables JSThis component aims to be a replacement for the popular DataTables JS:Fast rendering of large tables compared to DataTables with server side processingEasier implementation (e.g. not requiring any additional JavaScript code)Provides most of same basic features (e.g. Paging, Selectable page size, search, ...)How to useHere is a simple example for creating a data table for users of a Django site:settings.pyAdd this Django app to your site:INSTALLED_APPS=[..."htmx_datatables",...]views.pyCreate a view:fromhtmx_datatables.viewsimportHtmxDataTableViewclassMyDataTable(HtmxDataTableView):model=Usercolumns=["username","date_joined","is_superuser"]paginate_by=10For more information about features and configuration please see thesource codeforHtmxDataTableView.urls.pyAdd the new view to your urls:from.viewsimportMyDataTable...urlpatterns=[...path("users_data_table/",MyDataTable.as_view(),name="users_data_table"),...]index.htmlFinally, include the new data table in your Django template:{%loadhtmx_datatables%}{# ... #}{%render_htmx_datatableurl="my_app:users_data_table"%}{# ... #}{%enable_htmx_js%}Therender_htmx_datatabletemplate tag creates the widget.Theenable_htmx_jstemplate tag loads and enables htmx for this particular Django page (incl. error handling).Live exampleTo see how this widget works in practice you can check out out live example here:Live example website.The code for the live example can be found on the repo in the folderexample-app.
Package: django-htmx-refresh
This is a Django app to handle full-page reloads with HTMX.There are two possible use-cases for this app.Quick startdjango-htmx-refresh relies on the django-htmx package. You can
install it with pip:pip install django-htmxAdd “django_htmx_refresh” to your INSTALLED_APPS setting:INSTALLED_APPS = [
    ...
    'django_htmx_refresh',
]Include an app namespace for your project’s urls:path('app_path', include(('app.urls', 'app_namespace'))),MiddlewareFor when you want to handle htmx requests in all the views of a
particular app.Create a new list in your settings called HTMX_APPS:HTMX_APPS = [
    'app_namespace'
]This is so our custom middleware class only affects apps we explicity
define, preventing errors with other third-party apps such as the
default django admin application.Add HtmxResponseMiddleware to the MIDDLEWARE setting:MIDDLEWARE = [
    ...
    'django_htmx_refresh.middleware.HtmxResponseMiddleware',
]Note: TheHtmxReseponseMiddlewareclass provided with this
application uses theprocess_template_responsehook, meaning any
view you intend to be used with this class must return a response object
that implements arendermethod. Luckily Django’s class-based views
do this for us withTemplateResponse.MixinFor when you want to handle htmx requests in most of your views but not
necessarily all of them.Import the HtmxResponseMixin and add it to your view(s).from django_htmx_refresh.mixins import HtmxResponseMixin

class ExampleView(TemplateView, HtmxResponseMixin):
    template_name = 'template_name.html'
Package: django-htmx-rest
django-htmx-restA library for bringing together theDjango REST Frameworkandhtmx.htmx is a new javascript library based on Intercooler.js that allows you to
access modern browser features directly from HTML, rather than using
javascript.This library is super tiny for now, and focuses on providing a framework for
backend patterns that support htmx, like content negotiation and improvements
to DRF's browsable API.FeaturesContent NegotiationWe extend the default content negotiation behavior of DRF to serve a partial
template in the presence of htmx'sHx-Requestheader. Otherwise, the htmx
partial is wrapped in a full page. This does, however override DRF's
browsable API.In the future, the plan is to enhance DRF's browsable API, and to serve the
htmx component alongside the browsable data for a request fortext/htmlwithout theHx-Requestheader. This would allow the same view to serve
JSON, the htmx partial content, and a full browsable page for developers.
This feature can also include basic frontend development tooling like live
reloading and viewport resizing, like what Storybook and other isolated
UI development tools provide, allowing rapid development of htmx partials.Future FeaturesNew Spin on the Browsable APIWith htmx, your browsable API is not just a view into your application data,
but also a sort of storybook for UI components, as expressed by HTMX partials.If you directly visit ahtmx-restview in your browser, you will still be
able to access the DRF browsable API, but you'll also be able to see and
interact with the HTMX component in isolation with live reloading, and basic UI
development tools, like changing the viewport size, and viewing the context
data being passed into the templateAlso, to help you browse through all yourhtmx-restviews, our browsable
interface has a sidebar listing all of thehtmx-restviews in your
application, so you can explore them.SetupFirst, install the package:pip install django-htmx-restThen, add put the following in yoursettings.pyfile:# settings.pyINSTALLED_APPS=[...'htmx_rest'...]REST_FRAMEWORK={'DEFAULT_CONTENT_NEGOTIATION_CLASS':'htmx_rest.negotiator.HtmxContentNegotiator','DEFAULT_RENDERER_CLASSES':['rest_framework.renderers.JSONRenderer',# optional, if you want the browsable api'rest_framework.renderers.BrowsableAPIRenderer',# this or some renderer other than the BrowsableAPIRenderer that can# render content_types of `text/html` must be present'htmx_rest.renderers.HTMXPartialTemplateRenderer',]}
Package: django-http2-push
# django_http2_push[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)A simple way to add Header LINK## Install```bashpip install django_http2_push```Update your `settings.py````pythonINSTALLED_APPS = [..."django_http2_push",...]MIDDLEWARE = [..."django_http2_push.middleware.PushHttp2Middleware",...]```## UsageIn the templates now use `static_push` instead of `static`.![template_html](docs/images/template_html.png)![header](docs/images/header_done.png)
Package: django-http-451
=====Http451=====Http451 is a simple Django app that implements http451 on django. It implements the following IEFT RFC:https://tools.ietf.org/html/rfc7725https://tools.ietf.org/id/draft-sahib-451-new-protocol-elements-03.txtQuick start-----------1. Install http451 via pip : `pip install django-http-451`2. Add 'http451' to your INSTALLED_APPS settings like:INSTALLED_APPS = [...'http451',]3. Run `python manage.py migrate` to create the http451 models.4. Start the development server and visit the admin page5. Block a resource add it through the admin page http451 section
Package: django-http-authentication
# django-http-authorizationThis django app adds decorators that fall back to a HTTP_AUTHORIAZATION instead of a django login form.This can be used for programs that want to interact with your web page but require login.E. g. to download a password protected file via wget or access an internal icalendar.The HTTP_AUTHORIZATION relys on `django.contrib.auth.authenticate`.## UsageImport the decorators```from http_authentication.decorators import http_authorization_staff_member_required, http_authorization_login_required```and add it to the view functions```@http_authorization_staff_member_requireddef protected_view(request):return HttpResponse("This page can also be accessed via HTTP_AUTHORIZATION")```