trex-model 1.6.7__tar.gz → 1.6.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of trex-model might be problematic. Click here for more details.
- {trex_model-1.6.7 → trex_model-1.6.9}/PKG-INFO +1 -1
- {trex_model-1.6.7 → trex_model-1.6.9}/setup.py +1 -1
- {trex_model-1.6.7 → trex_model-1.6.9}/trex_model.egg-info/PKG-INFO +1 -1
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/marketing_models.py +8 -5
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/merchant_models.py +27 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/merchant_helpers.py +3 -1
- {trex_model-1.6.7 → trex_model-1.6.9}/LICENSE +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/MANIFEST.in +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/README.md +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/setup.cfg +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trex_model.egg-info/SOURCES.txt +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trex_model.egg-info/requires.txt +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trex_model.egg-info/top_level.txt +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/conf.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/app_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/customer_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/reward_model_helpers.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/reward_transaction_helper.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/sales_transaction_helpers.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/import_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/merchant_promotion_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/message_model_helper.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/message_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/ndb_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/partnership_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/product_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/program_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/rating_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/system_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/task_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/test_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/transaction_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/user_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/model_decorator.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/pos_conf.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/program_conf.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/utils/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/utils/model/__init__.py +0 -0
- {trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/utils/model/model_util.py +0 -0
|
@@ -15,6 +15,7 @@ import logging
|
|
|
15
15
|
from _datetime import timedelta
|
|
16
16
|
from trexconf.program_conf import MERCHANT_NEWS_STATUS_PUBLISH
|
|
17
17
|
from trexconf.conf import MERCHANT_NEWS_BASE_URL
|
|
18
|
+
from trexlib.utils.common.common_util import sort_list
|
|
18
19
|
|
|
19
20
|
logger = logging.getLogger('model')
|
|
20
21
|
|
|
@@ -182,17 +183,19 @@ class MarketingImage(BaseNModel, DictModel):
|
|
|
182
183
|
'''
|
|
183
184
|
Merchant Account as ancestor
|
|
184
185
|
'''
|
|
185
|
-
image_label
|
|
186
|
-
image_file_type
|
|
187
|
-
image_file_public_url
|
|
188
|
-
image_file_storage_filename
|
|
186
|
+
image_label = ndb.StringProperty(required=True)
|
|
187
|
+
image_file_type = ndb.StringProperty(required=True)
|
|
188
|
+
image_file_public_url = ndb.StringProperty(required=True)
|
|
189
|
+
image_file_storage_filename = ndb.StringProperty(required=True)
|
|
190
|
+
created_datetime = ndb.DateTimeProperty(required=False, auto_now=True, default=datetime.min)
|
|
189
191
|
|
|
190
192
|
dict_properties = ['image_label', 'image_file_public_url', 'image_file_storage_filename', 'image_file_type']
|
|
191
193
|
|
|
192
194
|
@staticmethod
|
|
193
195
|
def list_by_merchant_acct(merchant_acct):
|
|
194
196
|
result = MarketingImage.query(ancestor=merchant_acct.create_ndb_key()).fetch(limit=conf.MAX_FETCH_RECORD)
|
|
195
|
-
|
|
197
|
+
sorted_result = sort_list(result,'created_datetime', reverse_order=True, default_value=datetime.min)
|
|
198
|
+
return sorted_result
|
|
196
199
|
|
|
197
200
|
@staticmethod
|
|
198
201
|
def upload_file(uploading_file, image_label, merchant_acct, bucket, image_file_type=None):
|
|
@@ -130,6 +130,33 @@ class MerchantAcct(MerchantMin):
|
|
|
130
130
|
return timezone.utcoffset(now).total_seconds() / 3600
|
|
131
131
|
return conf.DEFAULT_GMT_HOURS
|
|
132
132
|
|
|
133
|
+
def upload_logo(self, uploading_file, bucket, logo_file_type=None):
|
|
134
|
+
file_prefix = random_string(8)
|
|
135
|
+
logo_file_storage_filename = 'merchant/'+self.key_in_str+'/logo/'+file_prefix+'-'+uploading_file.filename
|
|
136
|
+
blob = bucket.blob(logo_file_storage_filename)
|
|
137
|
+
|
|
138
|
+
logger.debug('logo_file_storage_filename=%s', logo_file_storage_filename)
|
|
139
|
+
|
|
140
|
+
blob.upload_from_string(
|
|
141
|
+
uploading_file.read(),
|
|
142
|
+
content_type=uploading_file.content_type
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
uploaded_url = blob.public_url
|
|
146
|
+
|
|
147
|
+
logger.debug('uploaded_url=%s', uploaded_url)
|
|
148
|
+
logger.debug('logo_file_type=%s', logo_file_type)
|
|
149
|
+
|
|
150
|
+
if is_not_empty(self.logo_storage_filename):
|
|
151
|
+
old_logo_blob = bucket.get_blob(self.logo_storage_filename)
|
|
152
|
+
if old_logo_blob:
|
|
153
|
+
old_logo_blob.delete()
|
|
154
|
+
|
|
155
|
+
self.logo_public_url = uploaded_url
|
|
156
|
+
self.logo_storage_filename = logo_file_storage_filename
|
|
157
|
+
self.put()
|
|
158
|
+
deleteFromCache(self.key_in_str)
|
|
159
|
+
|
|
133
160
|
def update_setup_progress(self, setup_step):
|
|
134
161
|
if self.setup_progress is None:
|
|
135
162
|
self.setup_progress = {
|
|
@@ -130,7 +130,9 @@ def construct_merchant_acct_info(merchant_acct, referrer_code=None):
|
|
|
130
130
|
logger.debug('refer_a_friend_url after=%s', refer_a_friend_url)
|
|
131
131
|
|
|
132
132
|
refer_a_friend_deep_link = conf.REFER_A_FRIEND_DEEP_LINK.format(
|
|
133
|
-
referrer_data = encrypted_referrer_data
|
|
133
|
+
#referrer_data = encrypted_referrer_data
|
|
134
|
+
merchant_acct_code = merchant_acct.account_code,
|
|
135
|
+
referrer_code = referrer_code,
|
|
134
136
|
)
|
|
135
137
|
|
|
136
138
|
logger.debug('refer_a_friend_deep_link=%s', refer_a_friend_deep_link)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/reward_model_helpers.py
RENAMED
|
File without changes
|
{trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/reward_transaction_helper.py
RENAMED
|
File without changes
|
{trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/helper/sales_transaction_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/merchant_promotion_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.7 → trex_model-1.6.9}/trexmodel/models/datastore/spending_base_program_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|