Skip to main content

A Django app providing ingredient handling.

Project description

Quick start

  1. Add “dj_ingredient_field” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'dj_ingredient_field',
    ]
  2. To use lazy loaded widgets include this module in your urlpatterns:

    urlpatterns = [
        path('cooking/', include('dj_ingredient_field.urls')),
        ...
    ]
  3. That’s it!

Usage

Simply add the fields you need to your model:

from dj_ingredient_field import IngredientField, MeasurementUnitField

class MyModel(models.Model):
   ingredient = IngredientField()
   unit = MeasurementUnitField()

The fields map to Ingredient and MeasurementUnit classes:

from dj_ingredient_field import IngredientName, Ingredient, MeasurementUnit, INGREDIENT_UNITS

model.ingredient = Ingredient(IngredientName.I_ARUGULA)
model.unit = MeasurementUnit(**INGREDIENT_UNITS["Killogram"])

All the available ingredients can be found in the IngredientName enum

Ingredients and units can be customized, see ‘Settings’

Documentation

https://django-ingredient-field.readthedocs.io/en/latest

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-ingredient-field-1.4.2.tar.gz (73.0 kB view details)

Uploaded Source

File details

Details for the file django-ingredient-field-1.4.2.tar.gz.

File metadata

  • Download URL: django-ingredient-field-1.4.2.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11

File hashes

Hashes for django-ingredient-field-1.4.2.tar.gz
Algorithm Hash digest
SHA256 a9aa0fdb049889c5bd6ddce3360d0937fd0e7086c7315dc20ad61ab1560bd7b1
MD5 dec533b2b64b1805ff88c139ba6d53b4
BLAKE2b-256 a024ee00f234fdfa055ebcfa1c7b5eebff608ae66a6919a580e4be51c0c4eb14

See more details on using hashes here.

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