def post(self): kw = Offers.get_parm(self) include_geos = kw.get('geo_targeting') exclude_geos = kw.get('exclude_geo_targeting') geos = c().countries if include_geos: for geo in include_geos: geos.pop(geo) kw['exclude_geo_targeting'] = geos.keys() elif not exclude_geos: kw['geo_targeting'] = geos.keys() offer = Offers._save(**kw) self.redirect("/offer_affiliate?offer_id={}".format(offer._id))
def post(self, offer_id): kw = Offers.get_parm(self, type='modify') include_geos = kw.get('geo_targeting') exclude_geos = kw.get('exclude_geo_targeting') geos = c().countries if include_geos: for geo in include_geos: geos.pop(geo) kw['exclude_geo_targeting'] = geos.keys() elif not exclude_geos: kw['geo_targeting'] = geos.keys() Offers._update(offer_id, **kw) self.redirect("/offers/manage")