<s> 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> from django . db . models . deletion import ProtectedError <EOL> __all__ = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ python_2_unicode_compatible <EOL> class Link ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( self . content_type , self . object_id ) <EOL> @ python_2_unicode_compatible <EOL> class Place ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> links = generic . GenericRelation ( Link ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % self . name <EOL> @ python_2_unicode_compatible <EOL> class Restaurant ( Place ) : <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % self . name <EOL> @ python_2_unicode_compatible <EOL> class Address ( models . Model ) : <EOL> street = models . CharField ( max_length = <NUM_LIT> ) <EOL> city = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> state = models . CharField ( max_length = <NUM_LIT:2> ) <EOL> zipcode = models . CharField ( max_length = <NUM_LIT:5> ) <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % ( self . street , self . city , self . state , self . zipcode ) <EOL> @ python_2_unicode_compatible <EOL> class Person ( models . Model ) : <EOL> account = models . IntegerField ( primary_key = True ) <EOL> name = models . CharField ( max_length = <NUM_LIT> ) <EOL> addresses = generic . GenericRelation ( Address ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> class CharLink ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> class TextLink ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . TextField ( ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> class OddRelation1 ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> clinks = generic . GenericRelation ( CharLink ) <EOL> class OddRelation2 ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> tlinks = generic . GenericRelation ( TextLink ) <EOL> class Note ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> note = models . TextField ( ) <EOL> class Contact ( models . Model ) : <EOL> notes = generic . GenericRelation ( Note ) <EOL> class Organization ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:255> ) <EOL> contacts = models . ManyToManyField ( Contact , related_name = '<STR_LIT>' ) <EOL> @ python_2_unicode_compatible <EOL> class Company ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> links = generic . GenericRelation ( Link ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % self . name <EOL> class Developer ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:15> ) <EOL> @ python_2_unicode_compatible <EOL> class Team ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:15> ) <EOL> members = models . ManyToManyField ( Developer ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % self . name <EOL> def __len__ ( self ) : <EOL> return self . members . count ( ) <EOL> class Guild ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:15> ) <EOL> members = models . ManyToManyField ( Developer ) <EOL> def __nonzero__ ( self ) : <EOL> return self . members . count ( ) <EOL> class Tag ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType , related_name = '<STR_LIT>' ) <EOL> object_id = models . CharField ( max_length = <NUM_LIT:15> ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> label = models . CharField ( max_length = <NUM_LIT:15> ) <EOL> class Board ( models . Model ) : <EOL> name = models . CharField ( primary_key = True , max_length = <NUM_LIT:15> ) <EOL> class SpecialGenericRelation ( generic . GenericRelation ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( SpecialGenericRelation , self ) . __init__ ( * args , ** kwargs ) <EOL> self . editable = True <EOL> self . save_form_data_calls = <NUM_LIT:0> <EOL> def save_form_data ( self , * args , ** kwargs ) : <EOL> self . save_form_data_calls += <NUM_LIT:1> <EOL> class HasLinks ( models . Model ) : <EOL> links = SpecialGenericRelation ( Link ) <EOL> class Meta : <EOL> abstract = True <EOL> class HasLinkThing ( HasLinks ) : <EOL> pass <EOL> class A ( models . Model ) : <EOL> flag = models . NullBooleanField ( ) <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> class B ( models . Model ) : <EOL> a = generic . GenericRelation ( A ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT:id>' , ) <EOL> class C ( models . Model ) : <EOL> b = models . ForeignKey ( B ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT:id>' , ) <EOL> class D ( models . Model ) : <EOL> b = models . ForeignKey ( B , null = True ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT:id>' , ) <EOL> class Node ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content = generic . GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> class Content ( models . Model ) : <EOL> nodes = generic . GenericRelation ( Node ) <EOL> related_obj = models . ForeignKey ( '<STR_LIT>' , on_delete = models . CASCADE ) <EOL> class Related ( models . Model ) : <EOL> pass <EOL> def prevent_deletes ( sender , instance , ** kwargs ) : <EOL> raise ProtectedError ( "<STR_LIT>" , [ instance ] ) <EOL> models . signals . pre_delete . connect ( prevent_deletes , sender = Node ) </s>
