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 hashes)

Uploaded Source

Supported by

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