<s> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from django . core . urlresolvers import reverse <EOL> from django . contrib . auth . models import User <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from tagging . models import Tag , TaggedItem <EOL> class TagVote ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> tagged_item = models . ForeignKey ( TaggedItem , <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> related_name = '<STR_LIT>' ) <EOL> user = models . ForeignKey ( User , <EOL> verbose_name = _ ( '<STR_LIT:user>' ) , <EOL> related_name = '<STR_LIT>' ) <EOL> vote = models . IntegerField ( ) <EOL> class Meta : <EOL> unique_together = ( ( '<STR_LIT>' , '<STR_LIT:user>' ) , ) <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> def __unicode__ ( self ) : <EOL> return u'<STR_LIT>' % ( self . user , self . tagged_item , self . vote ) <EOL> def get_absolute_url ( self ) : <EOL> ct = ContentType . objects . get ( app_label = '<STR_LIT>' , model = '<STR_LIT>' ) <EOL> if self . tagged_item . content_type == ct : <EOL> return reverse ( '<STR_LIT>' , <EOL> kwargs = { '<STR_LIT>' : self . tagged_item . tag . name } ) <EOL> else : <EOL> return reverse ( '<STR_LIT>' , <EOL> kwargs = { '<STR_LIT>' : self . tagged_item . tag . name } ) </s>
