<s> from __future__ import unicode_literals <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from rest_framework import serializers <EOL> def foobar ( ) : <EOL> return '<STR_LIT>' <EOL> class CustomField ( models . CharField ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> kwargs [ '<STR_LIT:max_length>' ] = <NUM_LIT:12> <EOL> super ( CustomField , self ) . __init__ ( * args , ** kwargs ) <EOL> class RESTFrameworkModel ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> class Meta : <EOL> app_label = '<STR_LIT>' <EOL> abstract = True <EOL> class HasPositiveIntegerAsChoice ( RESTFrameworkModel ) : <EOL> some_choices = ( ( <NUM_LIT:1> , '<STR_LIT:A>' ) , ( <NUM_LIT:2> , '<STR_LIT:B>' ) , ( <NUM_LIT:3> , '<STR_LIT:C>' ) ) <EOL> some_integer = models . PositiveIntegerField ( choices = some_choices ) <EOL> class Anchor ( RESTFrameworkModel ) : <EOL> text = models . CharField ( max_length = <NUM_LIT:100> , default = '<STR_LIT>' ) <EOL> class BasicModel ( RESTFrameworkModel ) : <EOL> text = models . CharField ( max_length = <NUM_LIT:100> , verbose_name = _ ( "<STR_LIT>" ) , help_text = _ ( "<STR_LIT>" ) ) <EOL> class SlugBasedModel ( RESTFrameworkModel ) : <EOL> text = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> slug = models . SlugField ( max_length = <NUM_LIT:32> ) <EOL> class DefaultValueModel ( RESTFrameworkModel ) : <EOL> text = models . CharField ( default = '<STR_LIT>' , max_length = <NUM_LIT:100> ) <EOL> extra = models . CharField ( blank = True , null = True , max_length = <NUM_LIT:100> ) <EOL> class CallableDefaultValueModel ( RESTFrameworkModel ) : <EOL> text = models . CharField ( default = foobar , max_length = <NUM_LIT:100> ) <EOL> class ManyToManyModel ( RESTFrameworkModel ) : <EOL> rel = models . ManyToManyField ( Anchor , help_text = '<STR_LIT>' ) <EOL> class ReadOnlyManyToManyModel ( RESTFrameworkModel ) : <EOL> text = models . CharField ( max_length = <NUM_LIT:100> , default = '<STR_LIT>' ) <EOL> rel = models . ManyToManyField ( Anchor ) <EOL> class Comment ( RESTFrameworkModel ) : <EOL> email = models . EmailField ( ) <EOL> content = models . CharField ( max_length = <NUM_LIT:200> ) <EOL> created = models . DateTimeField ( auto_now_add = True ) <EOL> class ActionItem ( RESTFrameworkModel ) : <EOL> title = models . CharField ( max_length = <NUM_LIT:200> ) <EOL> done = models . BooleanField ( default = False ) <EOL> info = CustomField ( default = '<STR_LIT>' , max_length = <NUM_LIT:12> ) <EOL> class Person ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:10> ) <EOL> age = models . IntegerField ( null = True , blank = True ) <EOL> @ property <EOL> def info ( self ) : <EOL> return { <EOL> '<STR_LIT:name>' : self . name , <EOL> '<STR_LIT>' : self . age , <EOL> } <EOL> class BlogPost ( RESTFrameworkModel ) : <EOL> title = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> writer = models . ForeignKey ( Person , null = True , blank = True ) <EOL> def get_first_comment ( self ) : <EOL> return self . blogpostcomment_set . all ( ) [ <NUM_LIT:0> ] <EOL> class BlogPostComment ( RESTFrameworkModel ) : <EOL> text = models . TextField ( ) <EOL> blog_post = models . ForeignKey ( BlogPost ) <EOL> class Album ( RESTFrameworkModel ) : <EOL> title = models . CharField ( max_length = <NUM_LIT:100> , unique = True ) <EOL> class Photo ( RESTFrameworkModel ) : <EOL> description = models . TextField ( ) <EOL> album = models . ForeignKey ( Album ) <EOL> class BlankFieldModel ( RESTFrameworkModel ) : <EOL> title = models . CharField ( max_length = <NUM_LIT:100> , blank = True , null = False ) <EOL> class OptionalRelationModel ( RESTFrameworkModel ) : <EOL> other = models . ForeignKey ( '<STR_LIT>' , blank = True , null = True ) <EOL> class Book ( RESTFrameworkModel ) : <EOL> isbn = models . CharField ( max_length = <NUM_LIT> ) <EOL> class ManyToManyTarget ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class ManyToManySource ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> targets = models . ManyToManyField ( ManyToManyTarget , related_name = '<STR_LIT>' ) <EOL> class ForeignKeyTarget ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class ForeignKeySource ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> target = models . ForeignKey ( ForeignKeyTarget , related_name = '<STR_LIT>' ) <EOL> class NullableForeignKeySource ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> target = models . ForeignKey ( ForeignKeyTarget , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> class OneToOneTarget ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> class NullableOneToOneSource ( RESTFrameworkModel ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:100> ) <EOL> target = models . OneToOneField ( OneToOneTarget , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> class BasicModelSerializer ( serializers . ModelSerializer ) : <EOL> class Meta : <EOL> model = BasicModel </s>
