<s> from django . db import models <EOL> from django . contrib import admin <EOL> from django . contrib . contenttypes import generic <EOL> from django . contrib . contenttypes . models import ContentType <EOL> class Episode ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class Media ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( ) <EOL> url = models . URLField ( verify_exists = False ) <EOL> def __unicode__ ( self ) : <EOL> return self . url <EOL> class MediaInline ( generic . GenericTabularInline ) : <EOL> model = Media <EOL> class EpisodeAdmin ( admin . ModelAdmin ) : <EOL> inlines = [ <EOL> MediaInline , <EOL> ] <EOL> admin . site . register ( Episode , EpisodeAdmin ) <EOL> class EpisodeExtra ( Episode ) : <EOL> pass <EOL> class MediaExtraInline ( generic . GenericTabularInline ) : <EOL> model = Media <EOL> extra = <NUM_LIT:0> <EOL> admin . site . register ( EpisodeExtra , inlines = [ MediaExtraInline ] ) <EOL> class EpisodeMaxNum ( Episode ) : <EOL> pass <EOL> class MediaMaxNumInline ( generic . GenericTabularInline ) : <EOL> model = Media <EOL> extra = <NUM_LIT:5> <EOL> max_num = <NUM_LIT:2> <EOL> admin . site . register ( EpisodeMaxNum , inlines = [ MediaMaxNumInline ] ) <EOL> class EpisodeExclude ( Episode ) : <EOL> pass <EOL> class MediaExcludeInline ( generic . GenericTabularInline ) : <EOL> model = Media <EOL> exclude = [ '<STR_LIT:url>' ] <EOL> admin . site . register ( EpisodeExclude , inlines = [ MediaExcludeInline ] ) <EOL> class Category ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> class PhoneNumber ( models . Model ) : <EOL> content_type = models . ForeignKey ( ContentType ) <EOL> object_id = models . PositiveIntegerField ( ) <EOL> content_object = generic . GenericForeignKey ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> phone_number = models . CharField ( max_length = <NUM_LIT:30> ) <EOL> category = models . ForeignKey ( Category , null = True , blank = True ) <EOL> class Meta : <EOL> unique_together = ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , ) , ) <EOL> class Contact ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:50> ) <EOL> phone_numbers = generic . GenericRelation ( PhoneNumber ) <EOL> class PhoneNumberInline ( generic . GenericTabularInline ) : <EOL> model = PhoneNumber <EOL> admin . site . register ( Contact , inlines = [ PhoneNumberInline ] ) <EOL> admin . site . register ( Category ) <EOL> class EpisodePermanent ( Episode ) : <EOL> pass <EOL> class MediaPermanentInline ( generic . GenericTabularInline ) : <EOL> model = Media <EOL> can_delete = False <EOL> admin . site . register ( EpisodePermanent , inlines = [ MediaPermanentInline ] ) </s>
