<s> from django import VERSION <EOL> from django . conf import settings <EOL> from django . contrib . contenttypes . fields import GenericForeignKey <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> def get_user_model_fk_ref ( ) : <EOL> """<STR_LIT>""" <EOL> ver = VERSION <EOL> if ver [ <NUM_LIT:0> ] >= <NUM_LIT:1> and ver [ <NUM_LIT:1> ] >= <NUM_LIT:5> : <EOL> return settings . AUTH_USER_MODEL <EOL> else : <EOL> return '<STR_LIT>' <EOL> class GenericLink ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( db_index = True ) <EOL> content_object = GenericForeignKey ( ) <EOL> url = models . URLField ( ) <EOL> title = models . CharField ( max_length = <NUM_LIT:200> ) <EOL> description = models . TextField ( max_length = <NUM_LIT:1000> , null = True , blank = True ) <EOL> user = models . ForeignKey ( get_user_model_fk_ref ( ) , null = True , blank = True ) <EOL> created_at = models . DateTimeField ( auto_now_add = True , db_index = True ) <EOL> is_external = models . BooleanField ( default = True , db_index = True ) <EOL> class Meta : <EOL> ordering = ( "<STR_LIT>" , ) <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> def __unicode__ ( self ) : <EOL> return self . url </s>
