Created
June 26, 2013 17:29
-
-
Save joshkehn/5869468 to your computer and use it in GitHub Desktop.
Ingredient and Meal models (Django)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ingredient (models.Model): | |
"""Describes an ingredient for meals. This ingredient contains specific | |
diet and food preference information and can be attached to multiple meals.""" | |
name = models.CharField(max_length=255) | |
franchise = models.ForeignKey(Franchise) | |
diets = models.ManyToManyField(Diet, null=True, blank=True, verbose_name="special diets or food allergies") | |
preferences = models.ManyToManyField(FoodPreference, null=True, blank=True) | |
class Meal (NutritionCapable, PricedModel, DatedModel): | |
"""Basic object representing a meal. NutritionCapable, PricedModel, | |
and DatedModel all come from a utility class that adds fields for | |
nutrition information, pricing information, and created/updated auto | |
fields.""" | |
name = models.CharField(max_length=255) | |
mc = models.ManyToManyField(MC, verbose_name="Menu Category") | |
ingredients = models.ManyToManyField(Ingredient) | |
def __uncode__ (self): | |
return unicode(self.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment