IngredientsΒΆ

The ingredient model is a simple model containing member fields that are used to describe the ingredient class (amount, description, etc.). The members are generally given defaults to allow flexible capabilities. The only relationship on the ingredient class is a ForeignKey to the Recipe model to allow connecting the ingredient to a single Recipe instance. (See notes for more detail on that connection)

class recipes.models.ingredient.Ingredient(*args, **kwargs)

Bases: django.db.models.base.Model

This class describes a single ingredient, including amount, measurement, and item description. The class includes model fields to describe the ingredient, plus one ForeignKey to a Recipe model instance. The only methods that are added to this model class are the __unicode__ and __str__ methods for representation.

AMOUNT_TYPE_CHOICES = (('0', u''), ('10', u'\u215b'), ('30', u'\t\xbc'), ('40', u'\u2153'), ('50', u'\xbd'), ('55', u'\u2154'), ('57', u'\xbe'), ('60', u'1'), ('65', u'1 \xbd'), ('70', u'2'), ('80', u'3'), ('90', u'4'), ('100', u'5'), ('110', u'6'), ('120', u'7'), ('130', u'8'), ('140', u'9'), ('150', u'10'), ('160', u'15'), ('170', u'20'))
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

MEASUREMENT_TYPE_CHOICES = (('0', u''), ('5', u'Pinch'), ('10', u'tsp'), ('20', u'Tbsp'), ('30', u'c'), ('40', u'pint'), ('50', u'qt'), ('60', u'liter'), ('70', u'gallon'), ('100', u'oz'), ('110', u'lb'))
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_amount_display(**morekwargs)
get_measurement_display(**morekwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

item_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

measurement

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
recipe

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

recipe_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.