Commit 31260d9d authored by 王浩's avatar 王浩

Merge branch 'test' into 'master'

Alpha 2.1

See merge request !276
parents ef397482 8002e667
import json
from datetime import datetime
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class ActivityListView(APIView):
......@@ -74,3 +74,66 @@ class ActivityDeleteView(APIView):
return r'操作失败'
return data
class PictorialActivityListView(APIView):
def get(self, request):
name = request.GET.get('name')
page = int(request.GET.get('page', 1))
count = int(request.GET.get('count', 10))
data = self.rpc['venus/sun/activity/pictrial/list'](name=name, offset=(page - 1) * count, count=count).unwrap()
if not data:
return r'获取失败'
return data
class PictorialActivityView(APIView):
def get(self, request):
id_ = int(request.GET.get('id'))
data = self.rpc['venus/sun/activity/pictrial/info'](id_=id_).unwrap()
if not data:
return r'获取失败'
return data.get("data")
def post(self, request):
data = {
"id": request.POST.get('id'),
"name": request.POST.get('name', None),
"start_time": request.POST.get('start_time'),
"end_time": request.POST.get('end_time'),
"version": request.POST.get('version', '0.0.0'),
"banner": request.POST.get('banner'),
"description": request.POST.get('description'),
"titles": json.loads(request.POST.get('titles', '[]'))
}
data = self.rpc['venus/sun/activity/pictrial/edit'](data=data).unwrap()
if not data:
return r'操作失败'
return data
class PictorialActivityOnlineView(APIView):
def post(self, request):
id_ = int(request.POST.get('id'))
is_online = int(request.POST.get('is_online'))
data = self.rpc['venus/sun/activity/pictrial/online'](id_=id_, is_online=is_online).unwrap()
if not data:
return r'操作失败'
return data
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class BrandListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
cn_name = request.GET.get('cn_name', None)
id_ = request.GET.get('id', None)
has_area = request.GET.get('has_area', None)
is_online = request.GET.get('is_online', None)
has_icon = request.GET.get('has_icon', None)
classify_id = request.GET.get('classify_id', None)
data = self.rpc['neptune/commodity/brand/list'](
offset=offset, count=count, cn_name=cn_name, id_=id_, has_area=has_area,
is_online=is_online, has_icon=has_icon, classify_id=classify_id).unwrap()
brand_ids = [obj.get('id') for obj in data]
brands_grade = self.rpc['neptune/commodity/brand/grade'](ids=brand_ids).unwrap()
grade_dict = {str(obj.get('brand_id')): obj.get('grade') for obj in brands_grade}
product_count = self.rpc['neptune/commodity/brand/product_count'](ids=brand_ids).unwrap()
category_infos = self.rpc['neptune/commodity/category/infos'](brand_ids=brand_ids).unwrap()
category_dict = {}
if category_infos:
for obj in category_infos:
obj_id = obj.get('brand_id')
if category_dict.get(str(obj_id)):
category_dict.get(str(obj_id)).append(obj)
else:
category_dict[str(obj_id)] = [obj]
classify_infos = self.rpc['neptune/commodity/classify/infos'](brand_ids=brand_ids).unwrap()
classify_dict = {str(obj.get('brand_id')): obj for obj in classify_infos} if classify_infos else {}
for obj in data:
brand_id = obj.get('id')
obj['product_num'] = product_count.get(str(brand_id)) or 0
category_info_list = category_dict.get(str(brand_id))
obj['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_info_list] if category_info_list else []
obj['grade'] = grade_dict.get(str(brand_id)) if grade_dict.get(str(brand_id)) else 0
classify_info = classify_dict.get(str(brand_id))
obj['classify_info'] = [{'id': classify_info.get('id'), 'cn_name': classify_info.get('cn_name')}] if classify_info else []
obj.pop('platform')
total = self.rpc['neptune/commodity/brand/count'](
cn_name=cn_name, id_=id_, has_area=has_area, is_online=is_online, has_icon=has_icon,
classify_id=classify_id).unwrap()
result = {
'list': data,
'total': total,
}
return result
class BrandInfoView(APIView):
def get(self, request):
id_ = request.GET.get('id')
data = self.rpc['neptune/commodity/brand/info'](id_=id_).unwrap()
classify_infos = self.rpc['neptune/commodity/classify/infos'](brand_ids=[id_]).unwrap()
data['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in classify_infos] if classify_infos else []
category_ids = self.rpc['neptune/commodity/brand/category_ids'](id_=id_).unwrap()
category_infos = self.rpc['neptune/commodity/category/infos'](ids=category_ids).unwrap()
data['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_infos] if category_infos else []
return data
class BrandCreateView(APIView):
def post(self, request):
cn_name = request.POST.get('cn_name')
icon = request.POST.get('icon', '')
en_name = request.POST.get('en_name', None)
alias = request.POST.get('alias', None)
area = request.POST.get('area', None)
classify_id = request.POST.get('classify_id', None)
category_ids = json.loads(request.POST.get('category_ids', '[]'))
description = request.POST.get('description', None)
is_online = request.POST.get('is_online', False)
if not cn_name or not classify_id:
return r'缺少参数'
data = self.rpc['neptune/commodity/brand/create'](
cn_name=cn_name, icon=icon, en_name=en_name, alias=alias, area=area,
classify_id=classify_id, description=description,
is_online=is_online).unwrap()
brand_id = data.get('id')
self.rpc['neptune/commodity/brand/batch_add_categorys'](
id_=brand_id, category_ids=category_ids).unwrap()
return data
class BrandUpdateView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
cn_name = request.POST.get('cn_name', None)
en_name = request.POST.get('en_name', None)
alias = request.POST.get('alias', None)
area = request.POST.get('area', None)
icon = request.POST.get('icon', None)
description = request.POST.get('description', None)
is_online = request.POST.get('is_online', None)
classify_id = request.POST.get('classify_id', None)
category_ids = json.loads(request.POST.get('category_ids', '[]'))
if not id_:
return r'缺少参数'
data = self.rpc['neptune/commodity/brand/update'](
id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, area=area, icon=icon,
description=description, is_online=is_online, classify_id=classify_id).unwrap()
self.rpc['neptune/commodity/brand/batch_add_categorys'](
id_=id_, category_ids=category_ids).unwrap()
return data
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class CategoryListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
cn_name = request.GET.get('cn_name')
data = self.rpc['neptune/commodity/category/list'](
offset=offset, count=count, cn_name=cn_name).unwrap()
for obj in data.get('list'):
obj.pop('platform')
return data
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class ClassifyListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
cn_name = request.GET.get('cn_name')
data = self.rpc['neptune/commodity/classify/list'](
offset=offset, count=count, cn_name=cn_name).unwrap()
return data
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class EffectListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
cn_name = request.GET.get('cn_name')
data = self.rpc['neptune/commodity/effect/list'](
offset=offset, count=count, cn_name=cn_name).unwrap()
return data
......@@ -67,12 +67,14 @@ class TopicHomeFixOperation(APIView):
image = request.POST.get('image')
protocol = request.POST.get("protocol")
pos = request.POST.get("pos", 4)
version = request.POST.get("version", 4)
if not image or not protocol:
return {'message': '参数不全'}
try:
self.rpc['venus/sun/operation/home_fix/edit'](image=image, protocol=protocol, pos=pos).unwrap()
self.rpc['venus/sun/operation/home_fix/edit'](image=image, protocol=protocol, pos=pos,
version=version).unwrap()
except Exception as e:
error_logger.error(u'更新失败', e)
raise
......
......@@ -45,10 +45,12 @@ class PictorialUpdateOrCreate(APIView):
return data
def post(self, request):
id = request.POST.get('id')
id = int(request.POST.get('id')) if request.POST.get('id') else None
star_ids = json.loads(request.POST.get('star', '[]'))
pictorial_user_ids = json.loads(request.POST.get('pictorial_user_ids', '[]'))
collection_tag_ids = json.loads(request.POST.get('collection_tag_ids', '[]'))
pictorial_activity_id = request.POST.get('pictorial_activity_id')
data = {
'name': request.POST.get('name', ''),
'description': request.POST.get('description', ''),
......@@ -62,7 +64,9 @@ class PictorialUpdateOrCreate(APIView):
'is_home_recommend': int(request.POST.get('is_home_recommend', 0)),
'add_score': int(request.POST.get('add_score', 0)),
'is_public': True if request.POST.get('is_public') == "true" else False,
'is_feed': int(request.POST.get('is_feed',0))
'is_feed': int(request.POST.get('is_feed', 0)),
'pictorial_activity_ids': [int(pictorial_activity_id)] if pictorial_activity_id else [],
'alias': request.POST.get('alias', ''),
}
try:
......@@ -142,4 +146,4 @@ class PictorialFeedDelete(APIView):
raise
return {
'message': '删除成功'
}
\ No newline at end of file
}
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class ProductListView(APIView):
def get_brand_infos(self, product_ids):
brand_infos = self.rpc['neptune/commodity/brand/products_brand_info'](product_ids=product_ids).unwrap()
brand_product_dict = {str(obj.get('product_id')): obj for obj in brand_infos} if brand_infos else {}
return brand_product_dict
def get_category_infos(self, product_ids):
category_infos = self.rpc['neptune/commodity/category/products_category_info'](product_ids=product_ids).unwrap()
ret = {}
if not category_infos:
return ret
for obj in category_infos:
product_id = obj.get('product_id')
if ret.get(str(product_id)):
ret.get(str(product_id)).append(obj)
else:
ret[str(product_id)] = [obj]
return ret
def get_effect_infos(self, product_ids):
effect_infos = self.rpc['neptune/commodity/effect/products_effect_info'](product_ids=product_ids).unwrap()
ret = {}
if not effect_infos:
return ret
for obj in effect_infos:
product_id = obj.get('product_id')
if ret.get(str(product_id)):
ret.get(str(product_id)).append(obj)
else:
ret[str(product_id)] = [obj]
return ret
def get_classify_infos(self, product_ids):
classify_infos = self.rpc['neptune/commodity/classify/infos'](product_ids=product_ids).unwrap()
ret = {}
if not classify_infos:
return ret
for obj in classify_infos:
product_id = obj.get('product_id')
if ret.get(str(product_id)):
ret.get(str(product_id)).append(obj)
else:
ret[str(product_id)] = [obj]
return ret
def get(self, request):
offset, count = get_offset_count(request)
id_ = request.GET.get('id', None)
cn_name = request.GET.get('cn_name', None)
en_name = request.GET.get('en_name', None)
alias = request.GET.get('alias', None)
is_online = request.GET.get('is_online', None)
has_area = request.GET.get('has_area', None)
has_brand = request.GET.get('has_brand', None)
has_image = request.GET.get('has_image', None)
brand_id = request.GET.get('brand_id', None)
classify_id = request.GET.get('classify_id', None)
category_id = request.GET.get('category_id', None)
price_low = request.GET.get('price_low', None)
price_high = request.GET.get('price_high', None)
grade_low = request.GET.get('grade_low', None)
grade_high = request.GET.get('grade_high', None)
comment_nums_low = request.GET.get('comment_nums_low', None)
comment_nums_high = request.GET.get('comment_nums_high', None)
effect_name = request.GET.get('effect_name', None)
sorted_condition = request.GET.get('sorted_condition', None)
data = self.rpc['neptune/commodity/product/list'](
offset=offset, count=count, id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, is_online=is_online,
has_area=has_area, has_brand=has_brand, has_image=has_image, brand_id=brand_id, classify_id=classify_id,
category_id=category_id, price_low=price_low, price_high=price_high, grade_low=grade_low, grade_high=grade_high,
comment_nums_low=comment_nums_low, comment_nums_high=comment_nums_high, effect_name=effect_name,
sorted_condition=sorted_condition).unwrap()
product_ids = [obj.get('id') for obj in data]
brand_product_dict = self.get_brand_infos(product_ids)
category_product_dict = self.get_category_infos(product_ids)
effect_product_dict = self.get_effect_infos(product_ids)
classify_product_dict = self.get_classify_infos(product_ids)
for obj in data:
product_id = obj.get('id')
obj['brand_info'] = {
'id': brand_product_dict.get(str(product_id)).get('id'),
'cn_name': brand_product_dict.get(str(product_id)).get('cn_name')} if brand_product_dict.get(str(product_id)) else ''
obj['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
for obj in category_product_dict.get(str(product_id))] if category_product_dict.get(str(product_id)) else []
obj['effect_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
for obj in effect_product_dict.get(str(product_id))] if effect_product_dict.get(str(product_id)) else []
obj['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
for obj in classify_product_dict.get(str(product_id))] if classify_product_dict.get(str(product_id)) else []
obj.pop('norms')
obj.pop('country')
obj.pop('platform')
count = self.rpc['neptune/commodity/product/count'](
id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, is_online=is_online, has_area=has_area, has_brand=has_brand,
has_image=has_image, brand_id=brand_id, category_id=category_id, classify_id=classify_id, price_low=price_low,
price_high=price_high, grade_low=grade_low, grade_high=grade_high, comment_nums_low=comment_nums_low,
comment_nums_high=comment_nums_high, effect_name=effect_name).unwrap()
result = {
'list': data,
'total': count,
}
return result
class ProductInfoView(APIView):
def get_category_infos(self, product_id):
category_infos = self.rpc['neptune/commodity/category/infos'](product_id=product_id).unwrap()
if not category_infos:
return []
return [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_infos]
def get_effect_infos(self, product_id):
effect_infos = self.rpc['neptune/commodity/effect/infos'](product_id=product_id).unwrap()
if not effect_infos:
return []
return [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in effect_infos]
def get(self, request):
id_ = request.GET.get('id')
data = self.rpc['neptune/commodity/product/info'](id_=id_).unwrap()
data.pop('norms')
data.pop('country')
data.pop('platform')
brand_info = self.rpc['neptune/commodity/brand/infos'](product_id=id_).unwrap()
data['brand_info'] = {'id': brand_info[0].get('id'), 'cn_name': brand_info[0].get('cn_name')} if brand_info else {}
classify_infos = self.rpc['neptune/commodity/classify/infos'](product_ids=[id_]).unwrap()
data['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in classify_infos]
data['category_infos'] = self.get_category_infos(id_)
data['effect_infos'] = self.get_effect_infos(id_)
return data
class ProductCreateView(APIView):
def post(self, request):
cn_name = request.POST.get('cn_name', None)
en_name = request.POST.get('en_name', None)
alias = request.POST.get('alias', None)
image = request.POST.get('image', None)
norms = request.POST.get('norms', None)
grade = request.POST.get('grade', None)
price = request.POST.get('price', None)
country = request.POST.get('country', None)
description = request.POST.get('description', None)
comment_nums = request.POST.get('comment_nums', None)
classify_ids = json.loads(request.POST.get('classify_ids', '[]'))
category_ids = json.loads(request.POST.get('category_ids', '[]'))
effect_ids = json.loads(request.POST.get('effect_ids', '[]'))
is_online = request.POST.get('is_online')
brand_id = request.POST.get('brand_id')
if not cn_name or not image:
return r'缺少参数'
data = self.rpc['neptune/commodity/product/create'](
cn_name=cn_name, en_name=en_name, alias=alias, image=image, norms=norms, grade=grade, price=price,
country=country, description=description, comment_nums=comment_nums, classify_ids=classify_ids,
category_ids=category_ids, effect_ids=effect_ids, is_online=is_online, brand_id=brand_id).unwrap()
return data
class ProductUpdateView(APIView):
def post(self, request):
id_ = request.POST.get('id')
cn_name = request.POST.get('cn_name', None)
en_name = request.POST.get('en_name', None)
alias = request.POST.get('alias', None)
image = request.POST.get('image', None)
norms = request.POST.get('norms', None)
grade = request.POST.get('grade', None)
price = request.POST.get('price', None)
country = request.POST.get('country', None)
description = request.POST.get('description', None)
comment_nums = request.POST.get('comment_nums', None)
classify_ids = json.loads(request.POST.get('classify_ids', '[]'))
category_ids = json.loads(request.POST.get('category_ids', '[]'))
effect_ids = json.loads(request.POST.get('effect_ids', '[]'))
is_online = request.POST.get('is_online')
brand_id = request.POST.get('brand_id')
if not id_:
return r'缺少参数'
data = self.rpc['neptune/commodity/product/update'](
id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, image=image, norms=norms, grade=grade, price=price,
country=country, description=description, comment_nums=comment_nums, classify_ids=classify_ids,
category_ids=category_ids, effect_ids=effect_ids, is_online=is_online, brand_id=brand_id).unwrap()
return data
......@@ -97,11 +97,29 @@ class TagTypeSearchView(APIView):
class PictorialSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
offset, count = get_offset_count(request)
try:
data = self.rpc['venus/sun/pictorial/search'](name=name).unwrap()
data = self.rpc['venus/sun/pictorial/search'](name=name, offset=offset, count=count).unwrap()
except Exception as e:
raise e
return {
'data': ['{id}:{name}'.format(id=search_data['id'], name=search_data['name']) for search_data in data]
}
class PictorialActivitySearchView(APIView):
def get(self, request):
name = request.GET.get('name')
offset, count = get_offset_count(request)
try:
data = self.rpc['venus/sun/activity/pictorial/search'](name=name, offset=offset, count=count).unwrap()
except Exception as e:
raise e
return {
'data': ['{id}:{name}'.format(id=search_data['id'], name=search_data['name']) for search_data in data]
}
\ No newline at end of file
......@@ -48,10 +48,12 @@ class TagUpdateOrCreateView(APIView):
return {'data': data}
def post(self, request):
id = request.POST.get('id')
down_tags = list(set(map(lambda x: x.split(":")[0], json.loads((request.POST.get('down_tags', '[]'))))))
up_tags = list(set(map(lambda x: x.split(":")[0], json.loads((request.POST.get('up_tags', '[]'))))))
tagtypes = list(set(map(lambda x: x.split(":")[0], json.loads((request.POST.get('tagtypes', '[]'))))))
data = {
'name': request.POST.get('name').lower(),
'description': request.POST.get('description', ''),
......@@ -62,7 +64,9 @@ class TagUpdateOrCreateView(APIView):
'platform': request.POST.get('platform', 1),
'collection': request.POST.get('collection', 0),
'alias': request.POST.get('alias', ''),
'is_show_in_register': request.POST.get('is_show_in_register', 'false')
'is_show_in_register': request.POST.get('is_show_in_register', 'false'),
'pictorial_ids': list(
(map(lambda x: int(x.split(":")[0]), json.loads((request.POST.get('pictorial_ids', '[]'))))))
}
try:
data = self.rpc['venus/sun/tag/edit'](id=id, data=data).unwrap()
......
......@@ -17,6 +17,7 @@ class TopicListView(APIView):
filters = json.loads(request.GET.get('filter', "{}"))
sorts_by = list(map(lambda i: int(i), request.GET.getlist('sort_params[]', [3])))
drop_score = request.GET.get('drop_score', None)
product_id = request.GET.get('product_id', None)
if user_id:
filters.update({'user_id': user_id})
......@@ -40,7 +41,7 @@ class TopicListView(APIView):
try:
data = self.rpc['venus/sun/topic/list'](
topic_ids=topic_ids, pictorial_id=pictorial_id
topic_ids=topic_ids, pictorial_id=pictorial_id, product_id=product_id,
).unwrap()
except Exception as e:
error_logger.error(u'获取帖子列表失败%s', e)
......@@ -244,3 +245,37 @@ class TopicBallot(APIView):
return {
"message": "更新成功"
}
class TopicProductAdd(APIView):
"""帖子添加商品关系"""
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
product_id = request.POST.get('product_id')
try:
self.rpc['venus/sun/topic/add_product'](ids=ids, product_id=product_id).unwrap()
except Exception as e:
error_logger.error(u'编辑%s帖子信息失败%s' % (ids, e))
raise
return {
'message': '更新成功'
}
class TopicProductDel(APIView):
"""帖子删除商品关系"""
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
product_id = request.POST.get('product_id')
try:
self.rpc['venus/sun/topic/del_product'](ids=ids, product_id=product_id).unwrap()
except Exception as e:
error_logger.error(u'编辑%s帖子信息失败%s' % (ids, e))
raise
return {
'message': '更新成功'
}
......@@ -26,6 +26,11 @@ from .tools import *
from .beauty import *
from .word_parent import *
from .activity import *
from .brand import *
from .product import *
from .category import *
from .classify import *
from .effect import *
urlpatterns = [
......@@ -59,6 +64,8 @@ urlpatterns = [
url(r'^topic/reply/create$', ReplyCreate.as_view()),
url(r'^topic/related_pictorial_info$', TopicRelatePictorialInfo.as_view()),
url(r'^topic/ballot$', TopicBallot.as_view()),
url(r'^topic/product/add$', TopicProductAdd.as_view()),
url(r'^topic/product/del$', TopicProductDel.as_view()),
# star相关
url(r'^celebrity/list$', CelebrityListView.as_view()),
......@@ -146,7 +153,6 @@ urlpatterns = [
url(r'^pictorial/feed/rank$', PictorialFeedlRank.as_view()),
url(r'^pictorial/feed/delete$', PictorialFeedDelete.as_view()),
#运营位
url(r'^topic/home_recommend/list', TopicHomeRecommendList.as_view()),
url(r'^topic/home_recommend/edit', TopicHomeRecommendEdit.as_view()),
......@@ -184,7 +190,32 @@ urlpatterns = [
url(r'^activity/create$', ActivityCreateView.as_view()),
url(r'^activity/update$', ActivityUpdateView.as_view()),
url(r'^activity/delete$', ActivityDeleteView.as_view()),
url(r'^activity/pictorial$', PictorialActivityView.as_view()),
url(r'^activity/pictorial$', PictorialActivityView.as_view()),
url(r'^activity/pictorial/list$', PictorialActivityListView.as_view()),
url(r'^activity/pictorial/online$', PictorialActivityOnlineView.as_view()),
# 品牌
url(r'^brand/list$', BrandListView.as_view()),
url(r'^brand/info$', BrandInfoView.as_view()),
url(r'^brand/create$', BrandCreateView.as_view()),
url(r'^brand/update$', BrandUpdateView.as_view()),
# 商品
url(r'^product/list$', ProductListView.as_view()),
url(r'^product/create$', ProductCreateView.as_view()),
url(r'^product/update$', ProductUpdateView.as_view()),
url(r'^product/info$', ProductInfoView.as_view()),
# 商品类目
url(r'^category/list$', CategoryListView.as_view()),
# 商品分类
url(r'^classify/list$', ClassifyListView.as_view()),
# 商品功效
url(r'^effect/list$', EffectListView.as_view()),
]
search_urlpatterns = [
......@@ -196,6 +227,7 @@ search_urlpatterns = [
url(r'search/topic$', TopicSearchView.as_view()),
url(r'search/tagtype$', TagTypeSearchView.as_view()),
url(r'search/pictorial$', PictorialSearchView.as_view()),
url(r'search/pictorial_activity$', PictorialActivitySearchView.as_view()),
]
common_urlpatterns = [
......
......@@ -69,7 +69,7 @@ class UserUpdateOrCreate(APIView):
data = {
'user_id': user_id,
'password': password,
'is_recommend': int(request.POST.get('is_recommend')),
'is_recommend': int(request.POST.get('is_recommend')) if request.POST.get('is_recommend') else 0,
'profile_pic': request.POST.get('avatar')[:-2],
'nick_name': request.POST.get('nick_name'),
'tag_ids': tag_ids,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment