<s> from django . contrib . contenttypes . fields import ( <EOL> GenericForeignKey , GenericRelation , <EOL> ) <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 Author ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> age = models . IntegerField ( ) <EOL> friends = models . ManyToManyField ( '<STR_LIT>' , blank = True ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> @ python_2_unicode_compatible <EOL> class Publisher ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:255> ) <EOL> num_awards = models . IntegerField ( ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> class ItemTag ( models . Model ) : <EOL> tag = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> content_type = models . ForeignKey ( ContentType , models . CASCADE ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ python_2_unicode_compatible <EOL> class Book ( models . Model ) : <EOL> isbn = models . CharField ( max_length = <NUM_LIT:9> ) <EOL> name = models . CharField ( max_length = <NUM_LIT:255> ) <EOL> pages = models . IntegerField ( ) <EOL> rating = models . FloatField ( ) <EOL> price = models . DecimalField ( decimal_places = <NUM_LIT:2> , max_digits = <NUM_LIT:6> ) <EOL> authors = models . ManyToManyField ( Author ) <EOL> contact = models . ForeignKey ( Author , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> publisher = models . ForeignKey ( Publisher , models . CASCADE ) <EOL> pubdate = models . DateField ( ) <EOL> tags = GenericRelation ( ItemTag ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT:name>' , ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> @ python_2_unicode_compatible <EOL> class Store ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:255> ) <EOL> books = models . ManyToManyField ( Book ) <EOL> original_opening = models . DateTimeField ( ) <EOL> friday_night_closing = models . TimeField ( ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> class Entries ( models . Model ) : <EOL> EntryID = models . AutoField ( primary_key = True , db_column = '<STR_LIT>' ) <EOL> Entry = models . CharField ( unique = True , max_length = <NUM_LIT:50> ) <EOL> Exclude = models . BooleanField ( default = False ) <EOL> class Clues ( models . Model ) : <EOL> ID = models . AutoField ( primary_key = True ) <EOL> EntryID = models . ForeignKey ( Entries , models . CASCADE , verbose_name = '<STR_LIT>' , db_column = '<STR_LIT>' ) <EOL> Clue = models . CharField ( max_length = <NUM_LIT> ) <EOL> class WithManualPK ( models . Model ) : <EOL> id = models . IntegerField ( primary_key = True ) <EOL> @ python_2_unicode_compatible <EOL> class HardbackBook ( Book ) : <EOL> weight = models . FloatField ( ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( self . name , self . weight ) <EOL> class Alfa ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:10> , null = True ) <EOL> class Bravo ( models . Model ) : <EOL> pass <EOL> class Charlie ( models . Model ) : <EOL> alfa = models . ForeignKey ( Alfa , models . SET_NULL , null = True ) <EOL> bravo = models . ForeignKey ( Bravo , models . SET_NULL , null = True ) <EOL> class SelfRefFK ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> parent = models . ForeignKey ( '<STR_LIT>' , models . SET_NULL , null = True , blank = True , related_name = '<STR_LIT>' ) </s>
