<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> class Relation ( models . Model ) : <EOL> pass <EOL> class AbstractPerson ( models . Model ) : <EOL> data_abstract = models . CharField ( max_length = <NUM_LIT:10> ) <EOL> fk_abstract = models . ForeignKey ( Relation , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> m2m_abstract = models . ManyToManyField ( Relation , related_name = '<STR_LIT>' ) <EOL> friends_abstract = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , symmetrical = True ) <EOL> following_abstract = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , symmetrical = False ) <EOL> data_not_concrete_abstract = models . ForeignObject ( <EOL> Relation , <EOL> on_delete = models . CASCADE , <EOL> from_fields = [ '<STR_LIT>' ] , <EOL> to_fields = [ '<STR_LIT:id>' ] , <EOL> related_name = '<STR_LIT>' , <EOL> ) <EOL> content_type_abstract = models . ForeignKey ( ContentType , models . CASCADE , related_name = '<STR_LIT:+>' ) <EOL> object_id_abstract = models . PositiveIntegerField ( ) <EOL> content_object_abstract = GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> generic_relation_abstract = GenericRelation ( Relation ) <EOL> class Meta : <EOL> abstract = True <EOL> class BasePerson ( AbstractPerson ) : <EOL> data_base = models . CharField ( max_length = <NUM_LIT:10> ) <EOL> fk_base = models . ForeignKey ( Relation , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> m2m_base = models . ManyToManyField ( Relation , related_name = '<STR_LIT>' ) <EOL> friends_base = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , symmetrical = True ) <EOL> following_base = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , symmetrical = False ) <EOL> data_not_concrete_base = models . ForeignObject ( <EOL> Relation , <EOL> on_delete = models . CASCADE , <EOL> from_fields = [ '<STR_LIT>' ] , <EOL> to_fields = [ '<STR_LIT:id>' ] , <EOL> related_name = '<STR_LIT>' , <EOL> ) <EOL> content_type_base = models . ForeignKey ( ContentType , models . CASCADE , related_name = '<STR_LIT:+>' ) <EOL> object_id_base = models . PositiveIntegerField ( ) <EOL> content_object_base = GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> generic_relation_base = GenericRelation ( Relation ) <EOL> class Person ( BasePerson ) : <EOL> data_inherited = models . CharField ( max_length = <NUM_LIT:10> ) <EOL> fk_inherited = models . ForeignKey ( Relation , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> m2m_inherited = models . ManyToManyField ( Relation , related_name = '<STR_LIT>' ) <EOL> friends_inherited = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , symmetrical = True ) <EOL> following_inherited = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , symmetrical = False ) <EOL> data_not_concrete_inherited = models . ForeignObject ( <EOL> Relation , <EOL> on_delete = models . CASCADE , <EOL> from_fields = [ '<STR_LIT>' ] , <EOL> to_fields = [ '<STR_LIT:id>' ] , <EOL> related_name = '<STR_LIT>' , <EOL> ) <EOL> content_type_concrete = models . ForeignKey ( ContentType , models . CASCADE , related_name = '<STR_LIT:+>' ) <EOL> object_id_concrete = models . PositiveIntegerField ( ) <EOL> content_object_concrete = GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> generic_relation_concrete = GenericRelation ( Relation ) <EOL> class ProxyPerson ( Person ) : <EOL> class Meta : <EOL> proxy = True <EOL> class PersonThroughProxySubclass ( ProxyPerson ) : <EOL> pass <EOL> class Relating ( models . Model ) : <EOL> baseperson = models . ForeignKey ( BasePerson , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> baseperson_hidden = models . ForeignKey ( BasePerson , models . CASCADE , related_name = '<STR_LIT:+>' ) <EOL> person = models . ForeignKey ( Person , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> person_hidden = models . ForeignKey ( Person , models . CASCADE , related_name = '<STR_LIT:+>' ) <EOL> proxyperson = models . ForeignKey ( ProxyPerson , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> proxyperson_hidden = models . ForeignKey ( ProxyPerson , models . CASCADE , related_name = '<STR_LIT>' ) <EOL> basepeople = models . ManyToManyField ( BasePerson , related_name = '<STR_LIT>' ) <EOL> basepeople_hidden = models . ManyToManyField ( BasePerson , related_name = '<STR_LIT:+>' ) <EOL> people = models . ManyToManyField ( Person , related_name = '<STR_LIT>' ) <EOL> people_hidden = models . ManyToManyField ( Person , related_name = '<STR_LIT:+>' ) <EOL> class CommonAncestor ( models . Model ) : <EOL> pass <EOL> class FirstParent ( CommonAncestor ) : <EOL> first_ancestor = models . OneToOneField ( CommonAncestor , models . SET_NULL , primary_key = True , parent_link = True ) <EOL> class SecondParent ( CommonAncestor ) : <EOL> second_ancestor = models . OneToOneField ( CommonAncestor , models . SET_NULL , primary_key = True , parent_link = True ) <EOL> class Child ( FirstParent , SecondParent ) : <EOL> pass </s>
