<s> from django . db import models <EOL> from google . appengine . ext import ndb <EOL> class UploadModel ( models . Model ) : <EOL> file = models . ImageField ( <EOL> upload_to = None , <EOL> ) <EOL> class ProfImage ( ndb . Model ) : <EOL> image = ndb . BlobProperty ( ) <EOL> developer_id = ndb . IntegerProperty ( ) <EOL> created_at = ndb . DateTimeProperty ( auto_now_add = True ) <EOL> updated_at = ndb . DateTimeProperty ( auto_now = True ) <EOL> content_type = ndb . StringProperty ( ) <EOL> @ classmethod <EOL> def getByDeveloper ( cls , developer_id ) : <EOL> query = cls . query ( cls . developer_id == developer_id ) <EOL> img = query . get ( ) <EOL> if img : <EOL> return img <EOL> return None <EOL> @ classmethod <EOL> def getEntity ( cls , developer_id ) : <EOL> img = cls . getByDeveloper ( developer_id ) <EOL> if img : <EOL> return img <EOL> return cls ( <EOL> developer_id = developer_id <EOL> ) <EOL> class AppImage ( ndb . Model ) : <EOL> image = ndb . BlobProperty ( ) <EOL> app_id = ndb . IntegerProperty ( ) <EOL> created_at = ndb . DateTimeProperty ( auto_now_add = True ) <EOL> updated_at = ndb . DateTimeProperty ( auto_now = True ) <EOL> content_type = ndb . StringProperty ( ) <EOL> @ classmethod <EOL> def getByAppId ( cls , app_id ) : <EOL> query = cls . query ( cls . app_id == app_id ) <EOL> img = query . get ( ) <EOL> if img : <EOL> return img <EOL> return None <EOL> @ classmethod <EOL> def getEntity ( cls , app_id ) : <EOL> img = cls . getByAppId ( app_id ) <EOL> if img : <EOL> return img <EOL> return cls ( <EOL> app_id = app_id , <EOL> ) </s>
