<commit_before>#!/usr/bin/env python
#:coding=utf-8:
#:tabSize=2:indentSize=2:noTabs=true:
#:folding=explicit:collapseFolds=1:

from django.db import models
from django.contrib.auth.models import User
# from util import enum

class Lifestream(models.Model):
  '''A lifestream itself.'''
  ls_title = models.CharField(max_length=128)
  ls_tagline = models.TextField(null=True, blank=True)
  
  ls_baseurl = models.CharField(max_length=1000)
  
  ls_user = models.ForeignKey(User)
  
  def __unicode__(self):
    return self.ls_title
  
  class Meta:
    db_table="lifestream"

class Feed(models.Model):
  '''A feed for gathering data.'''
  feed_lifestream = models.ForeignKey(Lifestream)
  
  feed_name = models.CharField(max_length=255)
  feed_url = models.CharField(max_length=1000)
  
  feed_domain = models.CharField(max_length=255)
  
  feed_deleted = models.BooleanField(default=False)
  
  def __unicode__(self):
    return self.feed_name
    
  class Meta:
    db_table="feeds"

class Tag(models.Model):
  '''item tag'''
  tag_slug = models.CharField(max_length=50, primary_key=True)
  tag_name = models.CharField(max_length=30)
  tag_count = models.IntegerField()
  
  tag_deleted = models.BooleanField(default=False)
  
  def __unicode__(self):
    return self.tag_name
  
  class Meta:
    db_table="tags"
    ordering=["tag_count"]

class Item(models.Model):
  '''A feed item'''
  item_feed = models.ForeignKey(Feed)
  item_date = models.DateTimeField()
  item_title = models.CharField(max_length=255)
  item_content = models.TextField(null=True, blank=True)
  item_content_type = models.CharField(max_length=255, null=True, blank=True)
  item_clean_content = models.TextField(null=True, blank=True)
  item_author = models.CharField(max_length=255, null=True, blank=True)
  item_permalink = models.CharField(max_length=1000)
  
  #Tag string used to save tags using django-tagging
  item_tags = models.ManyToManyField(Tag, null=True, blank=True, db_table="item_tags")
  
  item_published = models.BooleanField(default=True)
  item_deleted = models.BooleanField(default=False)
  
  def _get_item_link(self):
    return self.item_feed.feed_lifestream.ls_baseurl + "item/" + str(self.id)
  
  item_link = property(_get_item_link)
  
  def __unicode__(self):
    return self.item_title
    
  class Meta:
    db_table="items"
    ordering=["item_date", "item_feed"]<commit_msg>Updated models so they are better represented in the admin<commit_after>#!/usr/bin/env python
#:coding=utf-8:
#:tabSize=2:indentSize=2:noTabs=true:
#:folding=explicit:collapseFolds=1:

from django.db import models
from django.contrib.auth.models import User
# from util import enum

class Lifestream(models.Model):
  '''A lifestream itself.'''
  ls_title = models.CharField(max_length=128)
  ls_tagline = models.TextField(null=True, blank=True)
  
  ls_baseurl = models.CharField(max_length=1000)
  
  ls_user = models.ForeignKey(User)
  
  def __unicode__(self):
    return self.ls_title
  
  class Meta:
    db_table="lifestream"

class Feed(models.Model):
  '''A feed for gathering data.'''
  feed_lifestream = models.ForeignKey(Lifestream)
  
  feed_name = models.CharField(max_length=255, editable=False)
  feed_url = models.CharField(max_length=1000)
  
  feed_domain = models.CharField(max_length=255, editable=False)
  
  feed_deleted = models.BooleanField(default=False)
  
  def __unicode__(self):
    return self.feed_name
    
  class Meta:
    db_table="feeds"

class Tag(models.Model):
  '''item tag'''
  tag_slug = models.SlugField(primary_key=True)
  tag_name = models.CharField(max_length=30)
  tag_count = models.IntegerField()
  
  tag_deleted = models.BooleanField(default=False)
  
  def __unicode__(self):
    return self.tag_name
  
  class Meta:
    db_table="tags"
    ordering=["tag_count"]

class Item(models.Model):
  '''A feed item'''
  item_feed = models.ForeignKey(Feed)
  item_date = models.DateTimeField()
  item_title = models.CharField(max_length=255)
  item_content = models.TextField(null=True, blank=True)
  item_content_type = models.CharField(max_length=255, null=True, blank=True)
  item_clean_content = models.TextField(null=True, blank=True, editable=False)
  item_author = models.CharField(max_length=255, null=True, blank=True)
  item_permalink = models.CharField(max_length=1000)
  
  #Tag string used to save tags using django-tagging
  item_tags = models.ManyToManyField(Tag, null=True, blank=True, db_table="item_tags")
  
  item_published = models.BooleanField(default=True)
  item_deleted = models.BooleanField(default=False)
  
  def _get_item_link(self):
    return self.item_feed.feed_lifestream.ls_baseurl + "item/" + str(self.id)
  
  item_link = property(_get_item_link)
  
  def __unicode__(self):
    return self.item_title
    
  class Meta:
    db_table="items"
    ordering=["item_date", "item_feed"]
{'fraction_non_alphanumeric': 0.11473380107304994, 'fraction_numerical': 0.015270326042096575, 'mean_word_length': 4.910975609756098, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1521888', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1681, 'n_words': 298}