<commit_before># vim: et ts=4 sw=4
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
import datetime, re

# Create your models here.

class Posting(models.Model):
    feed = models.ForeignKey('Feed')
    origid = models.CharField(max_length=250,blank=True)
    title = models.CharField(max_length=250)
    link = models.URLField(blank=True)
    content = models.TextField()
    author = models.CharField(max_length=250, blank=True)
    publishdate = models.DateTimeField(default=datetime.datetime.now())

    def isread(self):
        return (self.marks.filter(mark='READ').count() > 0)
    def isstarred(self):
        return (self.marks.filter(mark='STAR').count() > 0)

    def displaywide(self):
        if self.feed.wide_allowed and len(re.sub('<[^>]+>', '', self.content)) > 100:
            return True
        return False

class Feed(models.Model):
    url = models.URLField()
    title = models.CharField(max_length=250)
    category = TreeForeignKey('Category', related_name="feeds", blank=True, null=True)
    wide_allowed = models.BooleanField(default=False, verbose_name="Allow big posts to display big")

    def __unicode__(self):
        return self.title
<commit_msg>Only show unread posts in wide, if at all.<commit_after># vim: et ts=4 sw=4
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
import datetime, re

# Create your models here.

class Posting(models.Model):
    feed = models.ForeignKey('Feed')
    origid = models.CharField(max_length=250,blank=True)
    title = models.CharField(max_length=250)
    link = models.URLField(blank=True)
    content = models.TextField()
    author = models.CharField(max_length=250, blank=True)
    publishdate = models.DateTimeField(default=datetime.datetime.now())

    def isread(self):
        return (self.marks.filter(mark='READ').count() > 0)
    def isstarred(self):
        return (self.marks.filter(mark='STAR').count() > 0)

    def displaywide(self):
        if self.feed.wide_allowed and not self.isread() and (len(re.sub('<[^>]+>', '', self.content)) > 100 or re.search('<img [^>]+>', self.content)):
            return True
        return False

class Feed(models.Model):
    url = models.URLField()
    title = models.CharField(max_length=250)
    category = TreeForeignKey('Category', related_name="feeds", blank=True, null=True)
    wide_allowed = models.BooleanField(default=False, verbose_name="Allow big posts to display big")

    def __unicode__(self):
        return self.title

{'fraction_non_alphanumeric': 0.13277843836702338, 'fraction_numerical': 0.015061434799841459, 'mean_word_length': 3.9490196078431374, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4691984', 'n_tokens_mistral': 811, 'n_tokens_neox': 768, 'n_words': 180}