Пример #1
0
        super(JobPostingPayment, self).save(*args, **kwargs)


class EventModerator(AnnounceModelModerator):
    pass


class JobModerator(AnnounceModelModerator):
    pass


class OpportunityModerator(AnnounceModelModerator):
    pass


moderator.register(Event, EventModerator)
moderator.register(Job, JobModerator)
moderator.register(Opportunity, OpportunityModerator)


class AnnounceCalendar(HTMLCalendar):
    """
    this is the calendar on the community page
    """

    def __init__(self, announcements):
        super(AnnounceCalendar, self).__init__()
        self.announcements = self.group_by_day(announcements)
        self.firstweekday = calendar.SUNDAY

    def formatday(self, day, weekday):
Пример #2
0
    def spam_message_text(self, user):
        return 'We\'re sorry, but your profile did not pass our spam filter.'

    def queued_message_text(self, user):
        return 'Your profile has been sent to our staff for moderation.'

    def admin_info(self, user):
        return (('username', user.username), ('email', user.email),
                ('url',
                 '<a target="_blank" href="%s">%s</a>' % (user.url, user.url)),
                ('first', user.first_name), ('last', user.last_name),
                ('bio', user.bio), ('facebook', user.facebook),
                ('twitter', user.twitter), ('intent', user.spam_question))


moderator.register(RhizomeUser, RhizomeUserModerator)


class UserRating(models.Model):
    '''
    Simple class for assigning values to users. Used in moderation of user-generated content. 
    The lower the rating, the higher the chances that user is spammer or needs to be moderated. 
    Pretty much a one-to-one relationship in terms of how many 
    public/moderated postings they have on the site. 
    If they spam site, many points are taken off.
    '''
    user = models.OneToOneField(User, related_name='user_rating')
    rating = models.IntegerField(max_length=11, db_index=True)


class UserObjectPoints(models.Model):
Пример #3
0
    def queued_message_text(self, user):
        return 'Your profile has been sent to our staff for moderation.'

    def admin_info(self, user):
        return (
            ('username', user.username),
            ('email', user.email),
            ('url', '<a target="_blank" href="%s">%s</a>' % (user.url, user.url)),
            ('first', user.first_name),
            ('last', user.last_name),
            ('bio', user.bio),
            ('facebook', user.facebook),
            ('twitter', user.twitter),
            ('intent', user.spam_question)
        ) 
moderator.register(RhizomeUser, RhizomeUserModerator)

class UserRating(models.Model):
    '''
    Simple class for assigning values to users. Used in moderation of user-generated content. 
    The lower the rating, the higher the chances that user is spammer or needs to be moderated. 
    Pretty much a one-to-one relationship in terms of how many 
    public/moderated postings they have on the site. 
    If they spam site, many points are taken off.
    '''
    user = models.OneToOneField(User, related_name='user_rating')
    rating = models.IntegerField(max_length = 11, db_index = True) 

class UserObjectPoints(models.Model):
    '''
    Very similar to activity stream, except logs points for users activity. 
Пример #4
0
        super(JobPostingPayment, self).save(*args, **kwargs)


class EventModerator(AnnounceModelModerator):
    pass


class JobModerator(AnnounceModelModerator):
    pass


class OpportunityModerator(AnnounceModelModerator):
    pass


moderator.register(Event, EventModerator)
moderator.register(Job, JobModerator)
moderator.register(Opportunity, OpportunityModerator)


class AnnounceCalendar(HTMLCalendar):
    '''
    this is the calendar on the community page
    '''
    def __init__(self, announcements):
        super(AnnounceCalendar, self).__init__()
        self.announcements = self.group_by_day(announcements)
        self.firstweekday = calendar.SUNDAY

    def formatday(self, day, weekday):
        if day != 0:
Пример #5
0
    def approved_message_text(self, comment):
        return '%s, your comment has been approved by our moderators.\n\nhttp://%s%s' % (
            comment.user.get_profile(), Site.objects.get_current().domain,
            comment.get_absolute_url())

    def admin_info(self, comment):
        return (
            ('author', '<a target="_blank" href="%s">%s</a>' %
             (comment.user.get_absolute_url(), comment.user.get_profile())),
            ('title', comment.title),
            ('submitted', comment.submit_date),
            ('body', comment.comment),
        )


moderator.register(DiscussionThread, DiscussionThreadModerator)
moderator.register(ThreadedComment, ThreadedCommentModerator)


# signals
def comment_handler(sender, comment, request, *args, **kwargs):
    discussion_thread_type = ContentType.objects.get(app_label='discuss',
                                                     model='discussionthread')
    if comment.content_type == discussion_thread_type:  # comment on a new or existing discuss thread
        thread = DiscussionThread.objects.get(pk=comment.object_pk)
        thread.last_comment_id = comment.id
        thread.save()
    else:  # comment on other site content post/artwork/etc...
        try:
            thread = DiscussionThread.objects.get(
                content_type=comment.content_type, object_pk=comment.object_pk)
Пример #6
0
    def approved_message_text(self, comment):
        return '%s, your comment has been approved by our moderators.\n\nhttp://%s%s' % (
            comment.user.get_profile(),
            Site.objects.get_current().domain,
            comment.get_absolute_url()
        )

    def admin_info(self, comment):
        return (
            ('author', '<a target="_blank" href="%s">%s</a>' % (comment.user.get_absolute_url(), comment.user.get_profile())),
            ('title', comment.title),
            ('submitted', comment.submit_date),
            ('body', comment.comment),
        )

moderator.register(DiscussionThread, DiscussionThreadModerator)
moderator.register(ThreadedComment, ThreadedCommentModerator)

# signals
def comment_handler(sender, comment, request, *args, **kwargs):
    discussion_thread_type = ContentType.objects.get(app_label='discuss', model='discussionthread')
    if comment.content_type == discussion_thread_type: # comment on a new or existing discuss thread
        thread = DiscussionThread.objects.get(pk=comment.object_pk)
        thread.last_comment_id = comment.id
        thread.save()
    else: # comment on other site content post/artwork/etc...
        try:
            thread = DiscussionThread.objects.get(content_type=comment.content_type, object_pk=comment.object_pk)
        except DiscussionThread.DoesNotExist:
            thread = DiscussionThread(content_type=comment.content_type, object_pk=comment.object_pk)
        thread.last_comment_id = comment.id