Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr ClassDef bases body Assign NameStore ListLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list NameLoad ClassDef bases NameLoad body Assign NameStore Call AttributeLoad NameLoad attr decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr keyword Str keyword Str Assign NameStore Call AttributeLoad NameLoad attr keyword Str keyword Str FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list NameLoad ClassDef bases AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str keyword Str FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list NameLoad ClassDef bases AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list NameLoad ClassDef bases AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list NameLoad ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Return Call AttributeLoad Call AttributeLoad Call NameLoad NameLoad NameLoad attr attr keyword NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad decorator_list
N/A N/A 
34. Generic relations

Generic relations let an object have a foreign key to any object through a
content-type/object-id field. A ``GenericForeignKey`` field can point to any
object, be it animal, vegetable, or mineral.

The canonical example is tags (although this example implementation is *far*
from complete).
 __future__ unicode_literals django.contrib.contenttypes generic django.contrib.contenttypes.models ContentType django.db models django.utils.encoding python_2_unicode_compatible TaggedItem N/A N/A models Model N/A N/A A tag on an item. N/A tag N/A N/A models SlugField N/A content_type N/A N/A models ForeignKey ContentType N/A object_id N/A N/A models PositiveIntegerField N/A content_object N/A N/A generic GenericForeignKey Meta N/A N/A N/A ordering N/A tag content_type__name N/A __str__ N/A N/A self N/A N/A N/A N/A self tag N/A N/A python_2_unicode_compatible ValuableTaggedItem N/A TaggedItem N/A N/A value N/A N/A models PositiveIntegerField N/A Comparison N/A N/A models Model N/A N/A 
    A model that tests having multiple GenericForeignKeys
     N/A comparative N/A N/A models CharField max_length 50 N/A content_type1 N/A N/A models ForeignKey ContentType related_name comparative1_set N/A object_id1 N/A N/A models PositiveIntegerField N/A content_type2 N/A N/A models ForeignKey ContentType related_name comparative2_set N/A object_id2 N/A N/A models PositiveIntegerField N/A first_obj N/A N/A generic GenericForeignKey ct_field content_type1 fk_field object_id1 N/A other_obj N/A N/A generic GenericForeignKey ct_field content_type2 fk_field object_id2 __str__ N/A N/A self N/A N/A N/A N/A %s is %s than %s N/A N/A self first_obj N/A self comparative N/A self other_obj N/A N/A python_2_unicode_compatible Animal N/A N/A models Model N/A N/A common_name N/A N/A models CharField max_length 150 N/A latin_name N/A N/A models CharField max_length 150 N/A tags N/A N/A generic GenericRelation TaggedItem N/A comparisons N/A N/A generic GenericRelation Comparison object_id_field object_id1 content_type_field content_type1 __str__ N/A N/A self N/A N/A N/A N/A self common_name N/A N/A python_2_unicode_compatible Vegetable N/A N/A models Model N/A N/A name N/A N/A models CharField max_length 150 N/A is_yucky N/A N/A models BooleanField default True N/A tags N/A N/A generic GenericRelation TaggedItem __str__ N/A N/A self N/A N/A N/A N/A self name N/A N/A python_2_unicode_compatible Mineral N/A N/A models Model N/A N/A name N/A N/A models CharField max_length 150 N/A hardness N/A N/A models PositiveSmallIntegerField __str__ N/A N/A self N/A N/A N/A N/A self name N/A N/A python_2_unicode_compatible GeckoManager N/A N/A models Manager N/A get_query_set N/A N/A self N/A N/A N/A N/A N/A N/A N/A N/A super GeckoManager self get_query_set filter has_tail True N/A N/A Gecko N/A N/A models Model N/A N/A has_tail N/A N/A models BooleanField N/A objects N/A GeckoManager N/A