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 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.0.tar.gz (5.6 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.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-chutney-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 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.0.tar.gz
Algorithm Hash digest
SHA256 8042303bca2afa3966ba5628d2673b9fa334aece81c66a80b86f783ea373d93e
MD5 922921bf16dd5d4adb21f86ebef99c17
BLAKE2b-256 4d626c91b3dac5917ad04b2cd322ce202e458ea5575c03f4e2ad61fd06a2d606

See more details on using hashes here.

Provenance

The following attestation bundles were made for django-chutney-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: django_chutney-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b1967492a94aa05807ea6f4ab95ad370ca4fae6166ba47b436552fed2ef6fae
MD5 058b239e320bba6ec53192a74ce2af11
BLAKE2b-256 298df201a74af89cf6f7293c5aef5d7624afee40a34ef1d9f62344ca39e65638

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_chutney-0.1.0-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