Exemple #1
0
    def get(self, aff_id):
        affiliate = Affiliate.find_one(dict(user_id=int(aff_id)))
        user = User._get(affiliate.user_id)
        spec = dict(deleted=False, role_id=Role.am()._id)
        account_managers = User.find(spec)
        affiliate['account'] = user.account
        affiliate['email'] = user.email
        affiliate['skype_id'] = user.skype_id
        affiliate['phone'] = user.phone
        affiliate['password'] = user.password

        self.render(account_managers=account_managers,
                    affiliate=affiliate,
                    invoice_frequency=InvoiceFrequency)
Exemple #2
0
    def get(self):
        offer_spce = dict(status={"$ne": 0}, is_api={"$ne": True})
        offers = Offers.find(offer_spce, dict(_id=1, title=1))

        affiliate_spec = dict(status={"$ne": 0})
        affiliates = Affiliate.find(affiliate_spec, dict(user_id=1))
        for aff in affiliates:
            user = User.find_one(dict(_id=int(aff.user_id)),
                                 dict(_id=1, account=1))
            if not user:
                continue
            aff['_id'] = user._id
            aff['name'] = user.account

        advertiser_spec = dict(status={"$ne": 0})
        advertisers = Advertisers.find(advertiser_spec, dict(user_id=1))
        for ad in advertisers:
            user = User.find_one(dict(_id=int(ad.user_id)),
                                 dict(_id=1, account=1))
            if not user:
                continue
            ad['_id'] = user._id
            ad['name'] = user.account

        categories = Category.find(dict(status={"$ne": 0}), dict(_id=1,
                                                                 name=1))

        ams = User.find(dict(role_id=Role.am()._id, deleted=False),
                        dict(_id=1, account=1, role_id=1))
        ams = [am for am in ams if am.role_id and am._role == 'AM']
        bds = User.find(dict(role_id=Role.bd()._id, deleted=False),
                        dict(_id=1, account=1, role_id=1))
        bds = [bd for bd in bds if bd.role_id and bd._role == 'BD']
        self.finish(
            dict(offers=offers,
                 affiliates=affiliates,
                 advertisers=advertisers,
                 categories=categories,
                 ams=ams,
                 bds=bds))
Exemple #3
0
    def get(self):

        spec = dict(role_id=Role.am()._id, deleted=False)
        account_managers = User.find(spec)
        self.render(account_managers=account_managers,
                    invoice_frequency=InvoiceFrequency)