<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals <EOL> from django . contrib . contenttypes import generic <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . db import models <EOL> from django . utils . encoding import python_2_unicode_compatible <EOL> @ python_2_unicode_compatible <EOL> class TaggedItem ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> tag = models . SlugField ( ) <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> class Meta : <EOL> ordering = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __str__ ( self ) : <EOL> return self . tag <EOL> class ValuableTaggedItem ( TaggedItem ) : <EOL> value = models . PositiveIntegerField ( ) <EOL> @ python_2_unicode_compatible <EOL> class Comparison ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> comparative = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> content_type1 = models . ForeignKey ( ContentType , related_name = "<STR_LIT>" ) <EOL> object_id1 = models . PositiveIntegerField ( ) <EOL> content_type2 = models . ForeignKey ( ContentType , related_name = "<STR_LIT>" ) <EOL> object_id2 = models . PositiveIntegerField ( ) <EOL> first_obj = generic . GenericForeignKey ( ct_field = "<STR_LIT>" , fk_field = "<STR_LIT>" ) <EOL> other_obj = generic . GenericForeignKey ( ct_field = "<STR_LIT>" , fk_field = "<STR_LIT>" ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( self . first_obj , self . comparative , self . other_obj ) <EOL> @ python_2_unicode_compatible <EOL> class Animal ( models . Model ) : <EOL> common_name = models . CharField ( max_length = <NUM_LIT> ) <EOL> latin_name = models . CharField ( max_length = <NUM_LIT> ) <EOL> tags = generic . GenericRelation ( TaggedItem ) <EOL> comparisons = generic . GenericRelation ( Comparison , <EOL> object_id_field = "<STR_LIT>" , <EOL> content_type_field = "<STR_LIT>" ) <EOL> def __str__ ( self ) : <EOL> return self . common_name <EOL> @ python_2_unicode_compatible <EOL> class Vegetable ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT> ) <EOL> is_yucky = models . BooleanField ( default = True ) <EOL> tags = generic . GenericRelation ( TaggedItem ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> @ python_2_unicode_compatible <EOL> class Mineral ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT> ) <EOL> hardness = models . PositiveSmallIntegerField ( ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> class GeckoManager ( models . Manager ) : <EOL> def get_query_set ( self ) : <EOL> return super ( GeckoManager , self ) . get_query_set ( ) . filter ( has_tail = True ) <EOL> class Gecko ( models . Model ) : <EOL> has_tail = models . BooleanField ( ) <EOL> objects = GeckoManager ( ) </s>
