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.1.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.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-chutney-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 946ce7da3b23c33362166176db662a86b8284f10f311c5575a493d9c8281cce9
MD5 30e7608571797f589485046312369388
BLAKE2b-256 53321f15b6580720e41d16f3da5fb72d4c23f1de844721fce669e0fd1c8b8ce5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: django_chutney-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a116e5dc8e9709312a151f908ef33e63e2e919b018a8741b3e22cee1a1eb4f1
MD5 ab419b3cfb599ad8dce65a25b9c3fcc9
BLAKE2b-256 39e837dad8168b2b0c08042ddc1cb42704f106cd76a95d42f6ef16baac8c7397

See more details on using hashes here.

Provenance

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