Example #1
0
class ProductModel(Mapping):
    token = TextField()
    name = TextField()
    picture = TextField()
    video = TextField()
    description = TextField()
    Offers = ListField(DictField(OfferModel))
    Pictures = ListField(DictField(PictureModel))
    @property
    def is_setup(self):
        return self.name and self.token

    @property
    def offers(self):
        return self.Offers

    @reify
    def offerMap(self):
        return {o.name:o for o in self.Offers}

    def getYoutubeVideoId(self):
        if self.video and 'youtube' in self.video:
            return getYoutubeVideoId(self.video)
        return ''

    def getVimeoVideoId(self):
        if self.video and 'vimeo' in self.video:
            return getVimeoVideoId(self.video)
        return ''
Example #2
0
class PageModel(Mapping):
    url = TextField()
    title = TextField()
    metaKeywords = TextField()
    metaDescription = TextField()
    content = TextField()
    active = BooleanField()
    linked = BooleanField()
Example #3
0
class RoleModel(NamedModel):
    key = TextField()
    label = TextField()

    def getKey(self, request):
        return self.key

    def getLabel(self, request):
        return request._(self.label)
Example #4
0
class BaseCompanyModel(Mapping):
    token = TextField()
    slug = TextField()

    url = TextField()

    name = TextField()
    pitch = TextField()
    description = TextField()
    logo = TextField()
    Pictures = ListField(DictField(PictureModel))
    Updates = ListField(DictField(UpdateModel))
    video = TextField()
    slideShare = TextField()

    def getUpdates(self):
        return sorted(self.Updates, key = attrgetter('created'), reverse = True)

    @property
    def display_name(self):
        if self.is_setup:
            return self.name
        else:
            return 'Your Company'

    @property
    def is_setup(self):
        return self.slug
    @property
    def logo_url(self):
        return self.logo
Example #5
0
class ExpertModel(Mapping):
    linkedinId = TextField()
    firstName = TextField()
    lastName = TextField()
    headline = TextField()
    picture = TextField()
    picture_url = property(default_user_pic('picture'))
    Introducer = ListField(DictField(IntroducerModel))


    introFirstName = TextField()
    introLastName = TextField()
    introPicture = TextField()
    introLinkedinId = TextField()

    @property
    def name(self):
        return u"{} {}".format(self.firstName, self.lastName)

    @property
    def position(self):
        return self.headline or 'IT Expert'
    @property
    def display_skills(self):
        return ', '.join([])
    @property
    def introducers(self):
        if not self.introFirstName: return []
        return [IntroducerModel(picture = self.introPicture, firstName = self.introFirstName, lastName = self.introLastName, linkedinId = self.introLinkedinId)]#self.Introducer
Example #6
0
class NeedModel(Mapping):
    token = TextField()
    slug = TextField()
    key = TextField()
    name = TextField()

    _inUse = BooleanField()
    parttime = BooleanField()
    summary = TextField()
    status = TextField()
    category = TextField()
    customText = TextField()
    picture = TextField()
    cash = IntegerField()
    equity = IntegerField()
    Tags = ListField(DictField(NamedModel))
    Applications = ListField(DictField(ApplicationModel))
    Endorsements = ListField(DictField(EndorsementModel))
    Company = DictField(BaseCompanyModel)

    Services = ListField(DictField(ServiceModel))
    Experts = ListField(DictField(ExpertModel))

    @reify
    def applicationMap(self):
        return {a.token:a for a in self.Applications}
    @reify
    def acceptedApplication(self):
        try:
            return [a for a in self.Applications if a.approved][0]
        except IndexError, e:
            return None
Example #7
0
class ApplicationModel(Mapping):

    token = TextField()
    message = TextField()
    approved = BooleanField()
    created = DateTimeField()
    User = DictField(CompanyUserModel)

    @property
    def display_date(self):
        return format_date(self.created, format='medium', locale='en')
Example #8
0
class IntroducerModel(Mapping):
    linkedinId = TextField()
    firstName = TextField()
    lastName = TextField()
    picture = TextField()
    picture_url = property(default_user_pic('picture'))

    @property
    def name(self):
        return u"{} {}".format(self.firstName, self.lastName)
    @property
    def position(self):
        return ""
Example #9
0
class VimeoMeta(Mapping):
    id = IntegerField()
    user_id = IntegerField()
    thumbnail_small = TextField()
    thumbnail_medium = TextField()
    thumbnail_large = TextField()
    description = TextField()
    duration = TextField()
    mobile_url = TextField()
    title = TextField()
    user_name = TextField()
Example #10
0
class CompanyModel(Mapping):
    id = IntegerField()
    token = TextField()

    name = TextField()
    display_name = TextField()
    high_concept = TextField()
    product_desc = TextField()
    logo_url = TextField()
    thumb_url = TextField()
    video_url = TextField()
    company_url = TextField()
    angellist_url = TextField()
    markets = ListField(DictField(MarketModel))
    screenshots = ListField(DictField(ScreenShotModel))
    pledges = ListField(DictField(ScreenShotModel))

    @property
    def display_name(self):
        return self.name
    @property
    def display_description(self):
        return self.high_concept

    @property
    def display_tags(self):
        return map(attrgetter("display_name"), self.markets)

    def getYoutubeVideoId(self):
        if self.video_url and 'youtube' in self.video_url:
            return getYoutubeVideoId(self.video_url)
        return ''

    def getVimeoVideoId(self):
        if self.video_url and 'vimeo' in self.video_url:
            return getVimeoVideoId(self.video_url)
        return ''

    def getFirstScreenShot(self):
        try:
            return self.screenshots[0].original
        except IndexError:
            return None
Example #11
0
class UserEndorsementsModel(Mapping):
    created = DateTimeField()
    endorserPicture = TextField()
    endorserName = TextField()
    endorserSlug = TextField()
    endorserToken = TextField()
    endorserHeadline = TextField()

    needName = TextField()
    needSlug = TextField()
    companyName = TextField()
    companySlug = TextField()

    @property
    def display_date(self):
        return format_date(self.created, format='medium')
Example #12
0
class SocialNetworkProfileModel(Mapping):
    id = TextField()
    network = TextField()
    picture = TextField()
    name = TextField()
    email = TextField()
    accessToken = TextField()
    secret = TextField()
    original = DictField()
Example #13
0
class NamedModel(Mapping):
    name = TextField()

    def getKey(self, request):
        return self.name

    def getLabel(self, request):
        return self.name

    def toQuery(self):
        return {'value': self.name, 'label': self.name}
Example #14
0
class CompanyUserModel(Mapping):
    token = TextField()
    slug = TextField()
    name = TextField()
    role = TextField()
    headline = TextField()
    picture = TextField()
    picture_url = property(default_user_pic('picture'))

    unconfirmed = BooleanField()
    startupValue = IntegerField()

    @property
    def isMentor(self):
        return self.role == "MENTOR"
    @property
    def isFounder(self):
        return self.role == "FOUNDER"
    @property
    def isTeamMember(self):
        return self.role != "MENTOR"

    @property
    def confirmed(self):
        return not self.unconfirmed

    @property
    def position(self):
        return getRoleName(self.role) if self.role else self.headline
    @property
    def displayStartupValue(self):
        return format_currency(self.startupValue, 'EUR')
Example #15
0
class FundingModel(Mapping):
    amount = IntegerField(default = 0)
    valuation = IntegerField(default = 0)
    description = TextField()
    contract = TextField()
    Investments = ListField(DictField(InvestmentModel))

    @property
    def display_equity(self):
        return '{}%'.format(format_decimal(100.0 * self.amount / self.valuation, format='#,###.##', locale='en'))  if self.valuation else '0%'
    @reify
    def invested_amount(self):
        return sum(map(attrgetter('amount'), self.Investments))

    def display_invested_amount(self, currency):
        return format_currency(self.invested_amount, currency)
    def display_amount(self, currency):
        return format_currency(self.amount, currency)

    @property
    def investment_progress(self):
        return "{}%".format(int(100.0 * self.invested_amount / self.amount)) if self.amount else '0%'
Example #16
0
class UserApplicationModel(ApplicationModel):
    comapnyLogo = TextField()
    companyName = TextField()
    companyToken = TextField()
    companySlug = TextField()
    need = TextField()
    needToken = TextField()
    needSlug = TextField()
    created = DateTimeField()

    @property
    def display_date(self):
        return format_date(self.created, format='medium')
Example #17
0
class CompanyRoleModel(Mapping):
    confirmed = BooleanField()
    role = TextField()
    hidden = BooleanField()
    startup = DictField(CompanyModel)
    tagged = DictField(CompanyRolePerson)

    def getPicture(self):
        return self.tagged.thumb_url or "//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm"
    def getPersonUrl(self):
        return self.tagged.angellist_url
    def getPersonName(self):
        return self.tagged.name
    def getPersonDescr(self):
        return self.tagged.bio or ''
Example #18
0
class TemplateModel(Mapping):
    key = TextField()
    name = TextField()
    logo = TextField()
    picture = TextField()
    description = TextField()
    Need = ListField(DictField(NeedModel))


    @reify
    def display_tags(self):
        result = set()
        for need in self.Need:
            result = result.union(set(need.tags))
        return result

    def groupedNeeds(self, n = 4):
        needs = self.Need
        length = len(needs)
        result = OrderedDict()
        for i, need in enumerate(needs):
            l = result.setdefault(i % n, [])
            l.append(need)
        return result.values()
Example #19
0
class UpdateModel(Mapping):
    text = TextField()
    created = DateTimeField()
    userName = TextField()
    userToken = TextField()
    userSlug = TextField()
    userHeadline = TextField()
    userPicture = TextField()
    picture_url = property(default_user_pic('userPicture'))
    def __repr__(self):
        return self.text
Example #20
0
class InviteModel(Mapping):
    invitorName = TextField()
    companySlug = TextField()
    companyName = TextField()
    name = TextField()
    role = TextField()
    inviteToken = TextField()
    Need = DictField(NeedModel)

    @property
    def position(self):
        return getRoleName(self.role)
Example #21
0
class PledgeModel(Mapping):
    name = TextField()
    network = TextField()
    networkId = TextField()
    slug = property(attrgetter('networkId'))
    confirmed = True
    picture = TextField()
    picture_url = property(default_user_pic('picture'))
    offerToken = TextField()
    offerName = TextField()
    comment = TextField()

    def is_native(self):
        return self.network.lower() == 'uf'

    # TODO: implement
    created = datetime(2013,1,1)
Example #22
0
class EndorsementModel(Mapping):
    endorserSlug = TextField()
    endorserToken = TextField()
    endorseeName = TextField()
    endorseeHeadline = TextField()
    endorseeLinkedinId = TextField()
    endorseePicture = TextField()
    picture_url = property(default_user_pic('endorseePicture'))
    @property
    def id(self):
        return self.endorseeLinkedinId
    def getPicture(self):
        return self.endorseePicture
    def getName(self):
        return self.endorseeName
    def getPosition(self):
        return self.endorseeHeadline
Example #23
0
class ServiceModel(Mapping):
    name = TextField()
    description = TextField()
    url = TextField()
    logo = TextField()

    worker = TextField()
    picture = TextField()
    picture_url = property(default_user_pic('picture'))

    @property
    def worker_name(self):
        return self.worker
    @property
    def worker_picture(self):
        return self.picture or "//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm"
    @property
    def logo_url(self):
        return self.logo
Example #24
0
class WebUserNetworkProfile(SocialNetworkProfileModel):
    type = TextField()

    def inferredNetwork(self):
        return SOCIAL_NETWORK_TYPES[self.type]
Example #25
0
class SlideShareMeta(Mapping):
    id = IntegerField()
    slideshow_id = IntegerField()
    thumbnail = TextField()
    title = TextField()
    author_name = TextField()
Example #26
0
class KeyValueModel(Mapping):
    key = TextField()
    value = TextField()
Example #27
0
class OfferModel(Mapping):
    token = TextField()
    name = TextField()
    description = TextField()
    stock = IntegerField()
    price = IntegerField()
Example #28
0
class CompanyModel(BaseCompanyModel):
    tagString = TextField()

    angelListId = TextField()
    angelListToken = TextField()
    currency = TextField()
    Template = DictField(TemplateModel)
    Round = DictField(RoundModel)
    Rounds = ListField(DictField(RoundModel))
    Users = ListField(DictField(CompanyUserModel))

    companyUrl = TextField()
    socialMediaUrl = TextField()


    totalValue = IntegerField()  # only for social friends companies
    @property
    def display_total_value(self):
        return format_currency(self.totalValue, 'EUR')
    @reify
    def startupValue(self):
        return sum(map(attrgetter('startupValue'), self.Users))
    @property
    def displayStartupValue(self):
        return format_currency(self.startupValue, 'EUR')
    @reify
    def memberMap(self):
        return {u.token:u for u in self.Users}

    @property
    def currency_symbol(self):
        return get_currency_symbol(self.currency, 'en')

    def isMember(self, userToken):
        if not userToken: return False
        member = self.memberMap.get(userToken)
        return member and not member.unconfirmed

    def isFounder(self, userToken):
        if not userToken: return False
        user = self.memberMap.get(userToken)
        return user and user.isFounder and not user.unconfirmed

    def isMentor(self, userToken):
        if not userToken: return False
        user = self.memberMap.get(userToken)
        return user and user.isMentor and not user.unconfirmed

    @property
    def no_users(self):
        return len(self.Users)

    @reify
    def mentorTokens(self):
        return set([m.token for m in self.mentors])

    @reify
    def mentors(self):
        return [u for u in self.Users if u.isMentor]
    @reify
    def members(self):
        return sorted([u for u in self.Users if u.isTeamMember], key = attrgetter('role'))

    @property
    def rounds(self):
        return [self.Round]
    @property
    def currentRound(self):
        return self.Round if self.Round else None
    def round_no(self, round):
        return 1

    @property
    def product_is_setup(self):
        try:
            return bool(self.Round.Product.token)
        except AttributeError:
            return False

    @property
    def product_description(self):
        return self.Round.Product.description if self.product_is_setup else ''

    @reify
    def product_pledges(self):
        return len(self.Round.Product.Pledges) if self.product_is_setup else 0

    @reify
    def product_name(self):
        return self.Round.Product.name if self.product_is_setup else ''



    def product_picture(self, request):
        product = self.Round.Product
        if not product: return None
        video = product.video
        if video:
            if 'youtube' in video:
                youtubeId  = getYoutubeVideoId(video)
                return 'http://img.youtube.com/vi/{}/0.jpg'.format(youtubeId)
            elif 'vimeo' in video:
                meta = getVimeoMeta(request, video)
                return meta.thumbnail_large if meta else None
            else: return video
        elif product.picture:
            return product.picture
        elif product.Pictures:
            return product.Pictures[0]
        else: return ''

    @property
    def display_tags(self):
        if self.is_setup:
            return self.tagString
        else:
            return ''

    @property
    def no_pledges(self):
        return len(self.pledgees)
    @property
    def pledgees(self):
        return self.Round and self.Round.Pledges or []
Example #29
0
class UserModel(Mapping):
    UserGroups = ['WebUser']
    token = TextField()
    slug = TextField()
    name = TextField()
    pwd = TextField()
    email = TextField()
    headline = TextField()
    picture = TextField()

    startupValue = IntegerField()
    investmentAmount = IntegerField()
    currency = TextField()
    interests = TextField()

    fbLink = TextField()
    xingLink = TextField()

    @property
    def liLink(self):
        liProfile = [n for n in self.Profile if n.type == 'LI'][0]
        return 'http://www.linkedin.com/profile/view?id={}'.format(
            liProfile['id'])

    Skills = ListField(DictField(NamedModel))
    Profile = ListField(DictField(WebUserNetworkProfile))
    Company = DictField(CompanyModel)
    Companies = ListField(DictField(CompanyModel))
    Applications = ListField(DictField(UserApplicationModel))
    Endorsements = ListField(DictField(UserEndorsementsModel))

    # mockMember
    picture_url = property(attrgetter('picture'))
    confirmed = True

    def isAnon(self):
        return self.token is None

    def toJSON(self, stringify=True):
        json = self.unwrap(sparse=True).copy()
        json.pop("Profile", None)
        json.pop("Companies", None)
        json.pop("Company", None)
        json.pop("Applications", None)
        json.pop("Endorsements", None)
        return simplejson.dumps(json) if stringify else json

    def getSocialProfileJSON(self, stringify=True):
        result = {
            n.inferredNetwork(): n.unwrap(sparse=True)
            for n in self.Profile if n.id
        }
        return simplejson.dumps(result) if stringify else result

    def getEndorsements(self):
        return self.Endorsements

    def isMe(self, network, id):
        map = {n.inferredNetwork(): n.id for n in self.Profile if n.id}
        netId = map.get(network)
        return netId == id

    @property
    def displayInvestment(self):
        return format_currency(self.investmentAmount, self.currency)

    @property
    def displayStartupValue(self):
        return format_currency(self.startupValue, 'EUR')

    def getPicture(self):
        if self.picture:
            return self.picture
        else:
            pics = [p.picture for p in self.Profile if p.picture]
            if len(pics):
                return pics[0]
            else:
                return "//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm"

    def getDefaultCompanySlug(self):
        return self.Company.slug if self.Company else None

    def getDefaultCompanyName(self):
        return self.Company.name if self.Company else None

    @reify
    def mentoredStartups(self):
        return [c for c in self.Companies if c.isMentor(self.token)]

    @reify
    def profileMap(self):
        return {n.network: n for n in self.Profile}

    @property
    def position(self):
        return self.headline

    @property
    def display_skills(self):
        if self and self.Skills:
            return map(attrgetter('name'), self.Skills)
        else:
            return ''

    @property
    def displayStartupValue(self):
        return format_currency(self.startupValue, 'EUR')
Example #30
0
class RoundModel(Mapping):
    start = DateTimeField()
    token = TextField()
    status = TextField()
    Needs = ListField(DictField(NeedModel))
    Users = ListField(DictField(CompanyUserModel))
    Pledges = ListField(DictField(PledgeModel))
    Product = DictField(ProductModel)
    Template = DictField(TemplateModel)
    Workflow = DictField(WorkflowModel)
    Funding = DictField(FundingModel)

    def getPledges(self):
        return sorted(self.Pledges, key = attrgetter('created'), reverse = True)

    @reify
    def expiry(self):
        return self.start+timedelta(STANDARD_RUN_TIME)
    @reify
    def needMap(self):
        return {n.slug:n for n in self.Needs}
    @reify
    def display_name(self):
        return self.Template.name
    @reify
    def expiry_days(self):
        delta = (self.start+timedelta(STANDARD_RUN_TIME)) - datetime.today()
        return delta.days + 1

    def getExpiryDays(self, singular = "{} Day Left", plural="{} Days Left", closed = "Closed"):
        days = self.expiry_days
        if 0 < days <= 1:
            return singular.format(days)
        elif days > 1:
            return plural.format(days)
        else:
            return closed
    def getExpiryDate(self):
        return format_date(self.start+timedelta(STANDARD_RUN_TIME), format="medium", locale='en')
    def getExpiryPercentage(self):
        delta = (self.start+timedelta(STANDARD_RUN_TIME)) - datetime.today()
        return 100.0 * (STANDARD_RUN_TIME-delta.days) / STANDARD_RUN_TIME
    @property
    def published(self):
        return self.status == 'PUBLISHED'
    @reify
    def pendingApproval(self):
        return self.Workflow.canPublish()
    @reify
    def noFulfilledNeeds(self):
        return len([n for n in self.Needs if n.fulfilled])
    @property
    def noTotalNeeds(self):
        return len([n for n in self.Needs if n.added])

    @property
    def roundTasks(self):
        return filter(attrgetter("customized"), self.Needs)

    def getRoundTaskSlugs(self):
        return [t.slug for t in self.roundTasks]