# Path: clipper/models.py
# class Article(models.Model):
#     """ A news article.  These will be the sources for answers. """
#     url = models.URLField(verify_exists=False, unique = True) 
#     news_organization = models.ForeignKey("NewsOrganization", related_name='articles_created') 
#     source = models.ForeignKey("NewsOrganization", related_name = 'articles_sourced')
#     authors = models.ManyToManyField(UserProfile) 
#     title = models.CharField(max_length=200)
#     date_published = models.DateTimeField(null=True)
#     # But we'll probably not be tagging articles initially, just aggregating tags from
#     # related clips
#     tags = models.ManyToManyField(Tag, null=True) 
# 
#     def __unicode__(self):
#         return self.title
# 
# Path: clipper/models.py
# class Clip(models.Model):
#     """ Relevent text from an article.  """
#     tags = models.ManyToManyField(Tag, null=True) 
#     article = models.ForeignKey(Article) 
#     user = models.ForeignKey(UserProfile)
#     text = models.TextField()
#     date_created = models.DateTimeField(auto_now_add=True)
#     user_comments = models.TextField()
# 
#     def __unicode__(self):
#         return self.text[:80]
# 
# Path: tagger/models.py
# class Tag(models.Model):
#     """ Generic class to implement tagging. """
#     name = models.CharField(max_length=80, db_index=True, unique = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# Path: users/models.py
# class UserProfile(models.Model):
#     """Extra user data.
#     
#     Fields:
# 
#     user: Django user for the profile.
#     facebook_user_id: User ID from the Facebook API.  This is populated if 
#                       the user chooses to register/login with Facebook.
#     is_verified: User has claimed account, filled in some optional fields.
#     reporter_verified: A reporter has contacted the user, probably for a story.
#     interest: Interest in seeking a user account.  This is populated by the 
#               signup form.
# 
#     """
# 
#     USER_TYPE_CHOICES = (
#     (u'R', u'reporter'),
#     (u'S', u'source'),
#     (u'A', u'author'))
# 
#     INTEREST_CHOICES = (
#         (u'', u'Neither or unanswered'),
#         (u'publisher', u'publisher'),
#         (u'consumer', u'consumer'),
#     )
# 
#     user = models.ForeignKey(User)
#     facebook_user_id = models.TextField(blank=True)
#     street_address = models.TextField(blank=True)
#     city = models.TextField(blank=True)
#     state = models.CharField(blank=True, max_length=2)
#     zip = models.CharField(blank=True, max_length=10)
#     phone_number = models.CharField(blank=True, max_length=12)
#     dob = models.DateField(blank=True, null = True)
#     user_type = models.CharField(max_length=15, choices = USER_TYPE_CHOICES)
#     is_verified = models.BooleanField(default = False)
#     reporter_verified = models.ForeignKey("UserProfile", blank=True, null=True)
#     interest = models.CharField(max_length=15, choices=INTEREST_CHOICES, 
#                                 default='', blank=True)
# 
#     def is_reporter(self):
#         return self.user_type == u'R'
# 
#     def __unicode__(self):
#         return self.user.username


from django.db import models
from django.contrib.sites.models import Site
from utils import comment_cmp, CountIfConcur, get_logger
from clipper.models import Article
from clipper.models import Clip
from tagger.models import Tag
from users.models import UserProfile
        return self.name

class CommentRelation(models.Model):
    """Extra information about the relationship between two comments.
    see http://docs.djangoproject.com/en/1.2./topics/db/models/#extra-fields-on-many-to-many-relationships"""
    left_comment = models.ForeignKey(Comment, related_name='+') 
    # Don't need to create an inverse relation
    right_comment = models.ForeignKey(Comment, related_name='+')
    # Don't need to create an inverse relation
    relation_type = models.CharField(max_length=15)

class CommentResponse(models.Model):
    """User response to a comment.

       These are responses that are not other comments.  This will
       implement the 'I also have this question' or 'I share this concern'
       functionality.  You can think of it as implementing Facebook 'like'
       style features."""

    COMMENT_RESPONSE_CHOICES = (
        ('share', 'I share this concern'),
        ('have', 'I have this question'),
        ('like', 'I like this'),
        ('concur', 'I concur'),
        ('opinion', 'This answer is primarily opinion'),
        ('accept', 'I accept this as the best answer'),
    )

    comment = models.ForeignKey(Comment)
    user = models.ForeignKey(UserProfile)

# Path: clipper/models.py
# class Article(models.Model):
#     """ A news article.  These will be the sources for answers. """
#     url = models.URLField(verify_exists=False, unique = True) 
#     news_organization = models.ForeignKey("NewsOrganization", related_name='articles_created') 
#     source = models.ForeignKey("NewsOrganization", related_name = 'articles_sourced')
#     authors = models.ManyToManyField(UserProfile) 
#     title = models.CharField(max_length=200)
#     date_published = models.DateTimeField(null=True)
#     # But we'll probably not be tagging articles initially, just aggregating tags from
#     # related clips
#     tags = models.ManyToManyField(Tag, null=True) 
# 
#     def __unicode__(self):
#         return self.title
# 
# Path: clipper/models.py
# class Clip(models.Model):
#     """ Relevent text from an article.  """
#     tags = models.ManyToManyField(Tag, null=True) 
#     article = models.ForeignKey(Article) 
#     user = models.ForeignKey(UserProfile)
#     text = models.TextField()
#     date_created = models.DateTimeField(auto_now_add=True)
#     user_comments = models.TextField()
# 
#     def __unicode__(self):
#         return self.text[:80]
# 
# Path: tagger/models.py
# class Tag(models.Model):
#     """ Generic class to implement tagging. """
#     name = models.CharField(max_length=80, db_index=True, unique = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# Path: users/models.py
# class UserProfile(models.Model):
#     """Extra user data.
#     
#     Fields:
# 
#     user: Django user for the profile.
#     facebook_user_id: User ID from the Facebook API.  This is populated if 
#                       the user chooses to register/login with Facebook.
#     is_verified: User has claimed account, filled in some optional fields.
#     reporter_verified: A reporter has contacted the user, probably for a story.
#     interest: Interest in seeking a user account.  This is populated by the 
#               signup form.
# 
#     """
# 
#     USER_TYPE_CHOICES = (
#     (u'R', u'reporter'),
#     (u'S', u'source'),
#     (u'A', u'author'))
# 
#     INTEREST_CHOICES = (
#         (u'', u'Neither or unanswered'),
#         (u'publisher', u'publisher'),
#         (u'consumer', u'consumer'),
#     )
# 
#     user = models.ForeignKey(User)
#     facebook_user_id = models.TextField(blank=True)
#     street_address = models.TextField(blank=True)
#     city = models.TextField(blank=True)
#     state = models.CharField(blank=True, max_length=2)
#     zip = models.CharField(blank=True, max_length=10)
#     phone_number = models.CharField(blank=True, max_length=12)
#     dob = models.DateField(blank=True, null = True)
#     user_type = models.CharField(max_length=15, choices = USER_TYPE_CHOICES)
#     is_verified = models.BooleanField(default = False)
#     reporter_verified = models.ForeignKey("UserProfile", blank=True, null=True)
#     interest = models.CharField(max_length=15, choices=INTEREST_CHOICES, 
#                                 default='', blank=True)
# 
#     def is_reporter(self):
#         return self.user_type == u'R'
# 
#     def __unicode__(self):
#         return self.user.username


# Path: core/models.py
from django.db import models
from django.contrib.sites.models import Site
from utils import comment_cmp, CountIfConcur, get_logger
from clipper.models import Article
from clipper.models import Clip
from tagger.models import Tag
from users.models import UserProfile

        return self.name

class CommentRelation(models.Model):
    """Extra information about the relationship between two comments.
    see http://docs.djangoproject.com/en/1.2./topics/db/models/#extra-fields-on-many-to-many-relationships"""
    left_comment = models.ForeignKey(Comment, related_name='+') 
    # Don't need to create an inverse relation
    right_comment = models.ForeignKey(Comment, related_name='+')
    # Don't need to create an inverse relation
    relation_type = models.CharField(max_length=15)

class CommentResponse(models.Model):
    """User response to a comment.

       These are responses that are not other comments.  This will
       implement the 'I also have this question' or 'I share this concern'
       functionality.  You can think of it as implementing Facebook 'like'
       style features."""

    COMMENT_RESPONSE_CHOICES = (
        ('share', 'I share this concern'),
        ('have', 'I have this question'),
        ('like', 'I like this'),
        ('concur', 'I concur'),
        ('opinion', 'This answer is primarily opinion'),
        ('accept', 'I accept this as the best answer'),
    )

    comment = models.ForeignKey(Comment)
    user = models.ForeignKey(UserProfile)

    type = models.CharField(max_length=20, choices=COMMENT_RESPONSE_CHOICES)