<s> import datetime <EOL> from django . db import models <EOL> class Author ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT:name>' , ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class BetterAuthor ( Author ) : <EOL> write_speed = models . IntegerField ( ) <EOL> class Book ( models . Model ) : <EOL> author = models . ForeignKey ( Author ) <EOL> title = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class Meta : <EOL> unique_together = ( <EOL> ( '<STR_LIT>' , '<STR_LIT:title>' ) , <EOL> ) <EOL> ordering = [ '<STR_LIT:id>' ] <EOL> def __unicode__ ( self ) : <EOL> return self . title <EOL> class BookWithCustomPK ( models . Model ) : <EOL> my_pk = models . DecimalField ( max_digits = <NUM_LIT:5> , decimal_places = <NUM_LIT:0> , primary_key = True ) <EOL> author = models . ForeignKey ( Author ) <EOL> title = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> def __unicode__ ( self ) : <EOL> return u'<STR_LIT>' % ( self . my_pk , self . title ) <EOL> class Editor ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class BookWithOptionalAltEditor ( models . Model ) : <EOL> author = models . ForeignKey ( Author ) <EOL> alt_editor = models . ForeignKey ( Editor , blank = True , null = True ) <EOL> title = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class Meta : <EOL> unique_together = ( <EOL> ( '<STR_LIT>' , '<STR_LIT:title>' , '<STR_LIT>' ) , <EOL> ) <EOL> def __unicode__ ( self ) : <EOL> return self . title <EOL> class AlternateBook ( Book ) : <EOL> notes = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> def __unicode__ ( self ) : <EOL> return u'<STR_LIT>' % ( self . title , self . notes ) <EOL> class AuthorMeeting ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> authors = models . ManyToManyField ( Author ) <EOL> created = models . DateField ( editable = False ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class CustomPrimaryKey ( models . Model ) : <EOL> my_pk = models . CharField ( max_length = <NUM_LIT:10> , primary_key = True ) <EOL> some_field = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class Place ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> city = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Owner ( models . Model ) : <EOL> auto_id = models . AutoField ( primary_key = True ) <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> place = models . ForeignKey ( Place ) <EOL> def __unicode__ ( self ) : <EOL> return "<STR_LIT>" % ( self . name , self . place ) <EOL> class Location ( models . Model ) : <EOL> place = models . ForeignKey ( Place , unique = True ) <EOL> lat = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> lon = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class OwnerProfile ( models . Model ) : <EOL> owner = models . OneToOneField ( Owner , primary_key = True ) <EOL> age = models . PositiveIntegerField ( ) <EOL> def __unicode__ ( self ) : <EOL> return "<STR_LIT>" % ( self . owner . name , self . age ) <EOL> class Restaurant ( Place ) : <EOL> serves_pizza = models . BooleanField ( ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Product ( models . Model ) : <EOL> slug = models . SlugField ( unique = True ) <EOL> def __unicode__ ( self ) : <EOL> return self . slug <EOL> class Price ( models . Model ) : <EOL> price = models . DecimalField ( max_digits = <NUM_LIT:10> , decimal_places = <NUM_LIT:2> ) <EOL> quantity = models . PositiveIntegerField ( ) <EOL> def __unicode__ ( self ) : <EOL> return u"<STR_LIT>" % ( self . quantity , self . price ) <EOL> class Meta : <EOL> unique_together = ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) <EOL> class MexicanRestaurant ( Restaurant ) : <EOL> serves_tacos = models . BooleanField ( ) <EOL> class ClassyMexicanRestaurant ( MexicanRestaurant ) : <EOL> restaurant = models . OneToOneField ( MexicanRestaurant , parent_link = True , primary_key = True ) <EOL> tacos_are_yummy = models . BooleanField ( ) <EOL> class Repository ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT> ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Revision ( models . Model ) : <EOL> repository = models . ForeignKey ( Repository ) <EOL> revision = models . CharField ( max_length = <NUM_LIT> ) <EOL> class Meta : <EOL> unique_together = ( ( "<STR_LIT>" , "<STR_LIT>" ) , ) <EOL> def __unicode__ ( self ) : <EOL> return u"<STR_LIT>" % ( self . revision , unicode ( self . repository ) ) <EOL> class Person ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT> ) <EOL> class Membership ( models . Model ) : <EOL> person = models . ForeignKey ( Person ) <EOL> date_joined = models . DateTimeField ( default = datetime . datetime . now ) <EOL> karma = models . IntegerField ( ) <EOL> class Team ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class Player ( models . Model ) : <EOL> team = models . ForeignKey ( Team , null = True ) <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Poet ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Poem ( models . Model ) : <EOL> poet = models . ForeignKey ( Poet ) <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Post ( models . Model ) : <EOL> title = models . CharField ( max_length = <NUM_LIT:50> , unique_for_date = '<STR_LIT>' , blank = True ) <EOL> slug = models . CharField ( max_length = <NUM_LIT:50> , unique_for_year = '<STR_LIT>' , blank = True ) <EOL> subtitle = models . CharField ( max_length = <NUM_LIT:50> , unique_for_month = '<STR_LIT>' , blank = True ) <EOL> posted = models . DateField ( ) <EOL> def __unicode__ ( self ) : <EOL> return self . name </s>
