<s> from __future__ import unicode_literals <EOL> from django . conf import settings <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . contrib . contenttypes . fields import GenericForeignKey <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> ACTION_COMMENT = <NUM_LIT:1> <EOL> ACTION_CREATED = <NUM_LIT:2> <EOL> ACTION_UPDATED = <NUM_LIT:3> <EOL> ACTION_WORKFLOW = <NUM_LIT:4> <EOL> ACTION_FILE = <NUM_LIT:5> <EOL> ACTION_TYPES = ( <EOL> ( ACTION_COMMENT , _ ( "<STR_LIT>" ) ) , <EOL> ( ACTION_CREATED , _ ( "<STR_LIT>" ) ) , <EOL> ( ACTION_UPDATED , _ ( "<STR_LIT>" ) ) , <EOL> ( ACTION_WORKFLOW , _ ( "<STR_LIT>" ) ) , <EOL> ( ACTION_FILE , _ ( "<STR_LIT>" ) ) , <EOL> ) <EOL> class ActivityQuerySet ( models . QuerySet ) : <EOL> def comments ( self ) : <EOL> return self . filter ( action = ACTION_COMMENT ) <EOL> class ActivityManager ( models . Manager ) : <EOL> use_for_related_fields = True <EOL> def get_queryset ( self ) : <EOL> return ActivityQuerySet ( self . model , using = self . _db ) <EOL> class Activity ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> user = models . ForeignKey ( <EOL> getattr ( settings , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> blank = True , <EOL> null = True , <EOL> on_delete = models . CASCADE , <EOL> ) <EOL> topic = models . CharField ( _ ( "<STR_LIT>" ) , max_length = <NUM_LIT:100> , blank = True , null = True , ) <EOL> text = models . TextField ( _ ( "<STR_LIT>" ) , blank = True , null = True , ) <EOL> action = models . PositiveSmallIntegerField ( <EOL> _ ( "<STR_LIT>" ) , <EOL> blank = False , <EOL> null = True , <EOL> editable = False , <EOL> default = ACTION_COMMENT , <EOL> choices = ACTION_TYPES , <EOL> ) <EOL> template = models . CharField ( _ ( "<STR_LIT>" ) , max_length = <NUM_LIT:100> , editable = False , blank = False , null = True ) <EOL> parent_id = models . PositiveIntegerField ( ) <EOL> parent_ct = models . ForeignKey ( <EOL> ContentType , related_name = "<STR_LIT>" , on_delete = models . CASCADE , <EOL> ) <EOL> parent_object = GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> modified = models . DateTimeField ( _ ( "<STR_LIT>" ) , auto_now = True , editable = False , ) <EOL> objects = ActivityManager ( ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT>' , ) <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> get_latest_by = "<STR_LIT>" <EOL> abstract = True </s>
