from django.conf import settings
from django.db import models


class Winery(models.Model):
    name = models.CharField(max_length=150)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = 'wineries'


class Wine(models.Model):
    winery = models.ForeignKey(Winery, related_name='wines')
    name = models.CharField(max_length=150)
    vintage = models.IntegerField()

    def __str__(self):
        return '{winery} {wine} {vintage}'.format(
            winery=self.winery, wine=self.name, vintage=self.vintage)

    class Meta:
        unique_together = ('winery', 'name', 'vintage',)


class Trait(models.Model):
    name = models.CharField(max_length=100, unique=True)

    def __str__(self):
        return self.name


class Note(models.Model):
    taster = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='notes')
    tasted = models.DateTimeField(null=True, blank=True)
    wine = models.ForeignKey(Wine)
    color_traits = models.ManyToManyField(
        Trait, related_name='color_notes', blank=True)
    nose_traits = models.ManyToManyField(
        Trait, related_name='nose_notes', blank=True)
    taste_traits = models.ManyToManyField(
        Trait, related_name='taste_notes', blank=True)
    finish_traits = models.ManyToManyField(
        Trait, related_name='finish_notes', blank=True)
    RATING_CHOICES = ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5),)
    rating = models.PositiveSmallIntegerField(
        choices=RATING_CHOICES, null=True, blank=True)

    def __str__(self):
        return 'Tasting note for: {wine}'.format(wine=self.wine)
@@ -1,20 +1,57 @@
+%22%22%22%0AContains models for API app.%0A%22%22%22%0A
 from django.conf imp
@@ -114,32 +114,91 @@
 (models.Model):%0A
+    %22%22%22A winery.%0A%0A    :param name: Name of winery.%0A    %22%22%22%0A
     name = model
@@ -356,24 +356,182 @@
 els.Model):%0A
+    %22%22%22A wine.%0A%0A    :param winery: Wine's assigned :class:%60Winery%60 object.%0A    :param name: Name of wine.%0A    :param vintage: Year wine was produced.%0A    %22%22%22%0A
     winery =
@@ -903,24 +903,86 @@
 els.Model):%0A
+    %22%22%22A wine trait.%0A%0A    :param name: Name of trait.%0A    %22%22%22%0A
     name = m
@@ -1099,24 +1099,673 @@
 els.Model):%0A
+    %22%22%22A wine tasting note.%0A%0A    :param taster: Note's assigned user model object.%0A    :param tasted: Date of wine tasting.%0A    :param wine: Note's assigned :class:%60Wine%60 object.%0A    :param color_traits: Note's assigned :class:%60Trait%60 objects for its%0A        color characteristics.%0A    :param nose_traits: Note's assigned :class:%60Trait%60 objects for its%0A        nose characteristics.%0A    :param taste_traits: Note's assigned :class:%60Trait%60 objects for its%0A        taste characteristics.%0A    :param finish_traits: Note's assigned :class:%60Trait%60 objects for its%0A        finish characteristics.%0A    :param rating: Rating of wine (1 to 5 stars).%0A    %22%22%22%0A
     taster =
@@ -2496,32 +2496,32 @@
  __str__(self):%0A
-
         return '
@@ -2564,12 +2564,13 @@
 e=self.wine)
+%0A

Add documentation for models of API app