<commit_before>"""
Models for the News application
"""

from django.contrib.auth.models import User
from django.db import models

from datetime import datetime
from easy_thumbnails.fields import ThumbnailerImageField
from taggit.managers import TaggableManager

from muckrock.foia.models import FOIARequest
from muckrock.tags.models import TaggedItemBase

class ArticleManager(models.Manager):
    """Object manager for news articles"""
    # pylint: disable=R0904

    def get_published(self):
        """Get all published news articles"""
        return self.filter(publish=True, pub_date__lte=datetime.now)

    def get_drafts(self):
        """Get all draft news articles"""
        return self.filter(publish=False)


class Article(models.Model):
    """A news article"""

    pub_date = models.DateTimeField('Publish date', default=datetime.now)
    title = models.CharField(max_length=200)
    kicker = models.CharField(max_length=200, blank=True)
    slug = models.SlugField(help_text='A "Slug" is a unique URL-friendly title for an object.')
    summary = models.TextField(help_text='A single paragraph summary or preview of the article.')
    body = models.TextField('Body text')
    authors = models.ManyToManyField(User, related_name='authored_articles')
    editors = models.ManyToManyField(User, related_name='edited_articles', blank=True, null=True)
    publish = models.BooleanField('Publish on site', default=True,
            help_text='Articles will not appear on the site until their "publish date".')
    foias = models.ManyToManyField(FOIARequest, related_name='articles', blank=True, null=True)
    image = ThumbnailerImageField(upload_to='news_images', blank=True, null=True,
                                  resize_source={'size': (510, 233), 'crop': 'smart'})

    objects = ArticleManager()
    tags = TaggableManager(through=TaggedItemBase, blank=True)<commit_msg>#476 default to false for publish on site<commit_after>"""
Models for the News application
"""

from django.contrib.auth.models import User
from django.db import models

from datetime import datetime
from easy_thumbnails.fields import ThumbnailerImageField
from taggit.managers import TaggableManager

from muckrock.foia.models import FOIARequest
from muckrock.tags.models import TaggedItemBase

class ArticleManager(models.Manager):
    """Object manager for news articles"""
    # pylint: disable=R0904

    def get_published(self):
        """Get all published news articles"""
        return self.filter(publish=True, pub_date__lte=datetime.now)

    def get_drafts(self):
        """Get all draft news articles"""
        return self.filter(publish=False)


class Article(models.Model):
    """A news article"""

    pub_date = models.DateTimeField('Publish date', default=datetime.now)
    title = models.CharField(max_length=200)
    kicker = models.CharField(max_length=200, blank=True)
    slug = models.SlugField(help_text='A "Slug" is a unique URL-friendly title for an object.')
    summary = models.TextField(help_text='A single paragraph summary or preview of the article.')
    body = models.TextField('Body text')
    authors = models.ManyToManyField(User, related_name='authored_articles')
    editors = models.ManyToManyField(User, related_name='edited_articles', blank=True, null=True)
    publish = models.BooleanField('Publish on site', default=False,
            help_text='Articles will not appear on the site until their "publish date".')
    foias = models.ManyToManyField(FOIARequest, related_name='articles', blank=True, null=True)
    image = ThumbnailerImageField(upload_to='news_images', blank=True, null=True,
                                  resize_source={'size': (510, 233), 'crop': 'smart'})

    objects = ArticleManager()
    tags = TaggableManager(through=TaggedItemBase, blank=True)
{'fraction_non_alphanumeric': 0.10458715596330276, 'fraction_numerical': 0.009174311926605505, 'mean_word_length': 4.435897435897436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6924301', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1087, 'n_words': 292}