Skip to main content

Tasty accompaniments to go with the Django web framework.

Project description

Django Chutney

Tasty accompaniments to go with the Django web framework

My personal collection of miscellaneous useful bits of code for use in Django projects.

Installation

pip install django-chutney

Usage

The library is intended to be a pick and mix bucket from which you can choose to use whichever bits you want.

Test cases

Handy test cases for testing HTML pages and forms.

These require BeautifulSoup to be installed:

pip install beautifulsoup4>=4
from django_chutney.test.testcases import FormTestCase, SoupCase

class MyTestCase(SoupSoup):

    def test_page(self):
        response = self.client.get(reverse("my_view"))
        soup = self.soup(response)
        # Test that a link to a specific URL exists, with order-insensitive query params
        self.assert_link_in_soup(soup, "https://www.thing.com/?unordered=query&params=value")


class MyFormTestCase(FormTestCase):

    def test_form_page(self):
        page_response = self.client.get(reverse("my_view"))
        # Submit a form to the page, with automatic checking that the values you're submitting are
        # possible values for a browser to submit based on the HTML of the form in the page.
        # Also submits hidden values that are in the form, even if you don't specific them.
        data = {"field1": "some-value"}
        post_response = self.submit_form(response, "#my-form", data)
        self.assertEqual(post_response.status_code, 302)

Template tags & filters

{% load chutney_tags %}
<p>
    Use a variable in the template as a key/attribute to extract an item from a dict/object:
</p>
<p>
    {{ my_dict|get:my_var }}
</p>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-chutney-0.1.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_chutney-0.1.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file django-chutney-0.1.2.tar.gz.

File metadata

  • Download URL: django-chutney-0.1.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django-chutney-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d9a3b190d66d1158dbf308fd133a274b5c0185f15f09b1275bf0c9ffe4f51a70
MD5 57997ec9cccf06dd82e9745e69b11f9f
BLAKE2b-256 8220b4fa3aa8e4b70e08030ca77a0cd01f17f760212cfdda5c36c5acc7721bac

See more details on using hashes here.

Provenance

The following attestation bundles were made for django-chutney-0.1.2.tar.gz:

Publisher: publish.yml on adamalton/django-chutney

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_chutney-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: django_chutney-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_chutney-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7512ea21b4a89cb51c2b90b2ac101593e94ee882afecf1e7f301c6ba752fd5cd
MD5 c3ff514f604b891327f82bf3daf97b78
BLAKE2b-256 d7313cebdf58abd3160eb3497a9d2f87d0c373264c2704251154660ae2059d63

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_chutney-0.1.2-py3-none-any.whl:

Publisher: publish.yml on adamalton/django-chutney

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page