from django.db import models
from timedelta import fields as timedelta_fields

from recipi.recipes.constants import UNIT_CHOICES
from recipi.utils.db.uuid import UUIDField


class Ingredient(models.Model):
    name = models.CharField(max_length=256)
    food = models.ForeignKey('food.Food', null=True, blank=True)
    nutrients = models.ManyToManyField('food.Nutrient', null=True, blank=True)


class RecipeIngredient(models.Model):
    recipe = models.ForeignKey('Recipe')
    ingredient = models.ForeignKey(Ingredient)

    unit = models.CharField(max_length=3, choices=UNIT_CHOICES)
    amount = models.PositiveIntegerField()


class Cuisine(models.Model):
    pass


class Picture(models.Model):
    pass


class Recipe(models.Model):
    id = UUIDField(auto=True, primary_key=True)
    url = models.URLField(max_length=2048, blank=True)

    title = models.CharField(max_length=80)

    # TODO: I think we're going to need some kind of shadow-user
    # account for automatic imports.
    author = models.ForeignKey('accounts.User')

    description = models.TextField(blank=True)

    ingredients = models.ManyToManyField(
        Ingredient,
        related_name='recipes',
        through='RecipeIngredient',
        blank=True
    )

    cuisines = models.ManyToManyField(
        Cuisine,
        related_name='recipes',
        blank=True
    )

    pictures = models.ManyToManyField(
        Picture,
        related_name='recipes',
        blank=True
    )

    # We're always talking about a one serving per 'Person' here.
    servings = models.PositiveIntegerField()

    # TODO: Are there any more units we need to measure?
    preparation_time = timedelta_fields.TimedeltaField()
    cook_time = timedelta_fields.TimedeltaField()

@@ -886,110 +886,8 @@
 0)%0A%0A
-    # TODO: I think we're going to need some kind of shadow-user%0A    # account for automatic imports.%0A
     
@@ -1479,65 +1479,8 @@
 ()%0A%0A
-    # TODO: Are there any more units we need to measure?%0A
     

Remove some todo notes