from django.db import models

from organizer.models import Startup, Tag


# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/


class Post(models.Model):
    title = models.CharField(max_length=63)
    slug = models.SlugField()
    text = models.TextField()
    pub_date = models.DateField()
    tags = models.ManyToManyField(Tag)
    startups = models.ManyToManyField(Startup)

from django.db import models

from organizer.models import Startup, Tag


# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/


class Post(models.Model):
    title = models.CharField(max_length=63)
    slug = models.SlugField(
        max_length=63,
        help_text='A label for URL config',
        unique_for_month='pub_date')
    text = models.TextField()
    pub_date = models.DateField(
        'date published',
        auto_now_add=True)
    tags = models.ManyToManyField(
        Tag, related_name='blog_posts')
    startups = models.ManyToManyField(
        Startup, related_name='blog_posts')

Add options to Post model fields.
Ch03: Add options to Post model fields. [skip ci]

  from django.db import models
  
  from organizer.models import Startup, Tag
  
  
  # Model Field Reference
  # https://docs.djangoproject.com/en/1.8/ref/models/fields/
  
  
  class Post(models.Model):
      title = models.CharField(max_length=63)
-     slug = models.SlugField()
+     slug = models.SlugField(
+         max_length=63,
+         help_text='A label for URL config',
+         unique_for_month='pub_date')
      text = models.TextField()
-     pub_date = models.DateField()
+     pub_date = models.DateField(
+         'date published',
+         auto_now_add=True)
-     tags = models.ManyToManyField(Tag)
+     tags = models.ManyToManyField(
+         Tag, related_name='blog_posts')
-     startups = models.ManyToManyField(Startup)
+     startups = models.ManyToManyField(
+         Startup, related_name='blog_posts')
  
Add options to Post model fields.
## Code Before:
from django.db import models

from organizer.models import Startup, Tag


# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/


class Post(models.Model):
    title = models.CharField(max_length=63)
    slug = models.SlugField()
    text = models.TextField()
    pub_date = models.DateField()
    tags = models.ManyToManyField(Tag)
    startups = models.ManyToManyField(Startup)

## Instruction:
Add options to Post model fields.
## Code After:
from django.db import models

from organizer.models import Startup, Tag


# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/


class Post(models.Model):
    title = models.CharField(max_length=63)
    slug = models.SlugField(
        max_length=63,
        help_text='A label for URL config',
        unique_for_month='pub_date')
    text = models.TextField()
    pub_date = models.DateField(
        'date published',
        auto_now_add=True)
    tags = models.ManyToManyField(
        Tag, related_name='blog_posts')
    startups = models.ManyToManyField(
        Startup, related_name='blog_posts')
