<s> from django . conf . urls . defaults import url <EOL> from django . contrib . auth . models import User <EOL> from tastypie . bundle import Bundle <EOL> from tastypie import fields <EOL> from tastypie . resources import ModelResource <EOL> from tastypie . authentication import SessionAuthentication <EOL> from tastypie . authorization import Authorization <EOL> from basic . models import Note , AnnotatedNote , SlugBasedNote <EOL> class UserResource ( ModelResource ) : <EOL> class Meta : <EOL> resource_name = '<STR_LIT>' <EOL> queryset = User . objects . all ( ) <EOL> authorization = Authorization ( ) <EOL> class CachedUserResource ( ModelResource ) : <EOL> class Meta : <EOL> allowed_methods = ( '<STR_LIT>' , ) <EOL> queryset = User . objects . all ( ) <EOL> resource_name = '<STR_LIT>' <EOL> def create_response ( self , * args , ** kwargs ) : <EOL> resp = super ( CachedUserResource , self ) . create_response ( * args , ** kwargs ) <EOL> resp [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> return resp <EOL> class NoteResource ( ModelResource ) : <EOL> user = fields . ForeignKey ( UserResource , '<STR_LIT:user>' ) <EOL> class Meta : <EOL> resource_name = '<STR_LIT>' <EOL> queryset = Note . objects . all ( ) <EOL> authorization = Authorization ( ) <EOL> class BustedResource ( ModelResource ) : <EOL> class Meta : <EOL> queryset = AnnotatedNote . objects . all ( ) <EOL> resource_name = '<STR_LIT>' <EOL> def get_list ( self , * args , ** kwargs ) : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> class SlugBasedNoteResource ( ModelResource ) : <EOL> class Meta : <EOL> queryset = SlugBasedNote . objects . all ( ) <EOL> resource_name = '<STR_LIT>' <EOL> detail_uri_name = '<STR_LIT>' <EOL> class SessionUserResource ( ModelResource ) : <EOL> class Meta : <EOL> resource_name = '<STR_LIT>' <EOL> queryset = User . objects . all ( ) <EOL> authentication = SessionAuthentication ( ) <EOL> authorization = Authorization ( ) </s>
