def post(self, request): user_id = request.data.get('user_id') img_data = [] img_lists = request.data.get('img_list') if img_lists: for img_list in img_lists: img_dic = {'status': 'success', 'uid': img_list['imgUid'], 'url': (Parsing(img_list['img64'], img_list['imgHZM']))} img_data.append(img_dic) user = Users.objects.filter(id=user_id).first() img = request.data.get('img') suffix_img = request.data.get('suffix_img') file_base = request.data.get('file_base') suffix = request.data.get('suffix') form = AttractClientForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = None print(form.errors) if form.is_valid(): data = form.cleaned_data try: if img: img = Parsing(img, suffix_img) attract = AttractInfo.objects.create(city=data['city'], area=data['area'], file_url=file_url, location=data['location'], serial_number=data['serial_number'], notice_date=data['notice_date'], land_nature=data['land_nature'], land_area=data['land_area'], total_inv=data['total_inv'], people=data['people'], plot_ratio=data['plot_ratio'], contact=data['contact'], cooperate_condition=data['cooperate_condition'], title=data['title'], content=data['content'], remark=data['remark'], reward_price=data['reward_price'], house_account=data['house_account'], img=img, desc=data['desc'], information_source=user.company, img_list=img_data, industry_requirements=data['industry_requirements'], coordinates=data['coordinates'], pcc=data['pcc'], ) ReleaseRecord.objects.create(user_id=user_id, land_id=attract.id, luyou='/tudimessage/zhaoshang') # users = Users.objects.filter(city__contains=attract.city) # for user in users: # YaoQing.objects.create(user_id=user.id, land_id=attract.id, luyou='/tudimessage/zhaoshang') except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功', 'id': attract.id}) return Response({'status': '0', 'msg': '数据不完整', 'data': form.errors})
def put(self, request): land_id = request.data.get('land_id') user_id = request.data.get('user_id') inv = InvestmentData.objects.filter(id=land_id).first() luyou = request.data.get('luyou') file_base = request.data.get('file_base') suffix = request.data.get('suffix') img_base = request.data.get('img_base') img_suffix = request.data.get('img_suffix') form = InvestmentInformationForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: if luyou == "/Investment/zhoubao": property_types = 1 elif luyou == "/Investment/yuebao": property_types = 2 elif luyou == "/Investment/jibao": property_types = 3 elif luyou == "/Investment/bannianbao": property_types = 4 elif luyou == "/Investment/nianbao": property_types = 5 else: property_types = 0 inv.title = data['title'] inv.content = data['content'] if img_suffix: os.remove('/var/www/html/static/images/landimages/' + inv.img) inv.img = Parsing(img_base, img_suffix) inv.desc = data['desc'] inv.reward_price = data['reward_price'] inv.information_source = data['information_source'] inv.property_type = property_types if suffix: os.remove('/var/www/html/static/images/landimages/' + inv.file_url) inv.file_url = Parsing(file_base, suffix) inv.file_introduction = data['file_introduction'] inv.save() ReleaseRecord.objects.create(user_id=user_id, land_id=inv.id, luyou=luyou) except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): file_base = request.data.get('file_base') suffix = request.data.get('suffix') form = BigDataForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = None print(form.errors) if form.is_valid(): data = form.cleaned_data try: BigData.objects.create( city=data['city'], positioning=data['positioning'], city_card=data['city_card'], GDP=data['GDP'], peo_num=data['peo_num'], pillar_industries=data['pillar_industries'], key_enterprises=data['key_enterprises'], development_plan=data['development_plan'], planning_for=data['planning_for'], file_url=file_url) except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): img = request.data.get('img') suffix = request.data.get('suffix') if not img: return Response({'msg': 'img没传', 'status': '0'}) data = {'img_name': Parsing(img, suffix)} return Response({'data': data, 'msg': '上传成功', 'status': '1'})
def put(self, request): user = Users.objects.filter(mobile=get_user_id(request)).first() img = request.data.get('img') suffix = request.data.get('suffix') form = EditForm(request.data) if suffix: img = Parsing(img, suffix) user.img = img print(form.errors) if form.is_valid(): data = form.cleaned_data try: user.job = data['job'] user.username = data['username'] user.company = data['company'] user.addr = data['addr'] user.city = data['city'] user.area = data['area'] user.intro = data['intro'] user.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功', 'data': user.img}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): user = Users.objects.filter(mobile=get_user_id(request)).first() img = request.data.get('img') suffix = request.data.get('suffix') form = SelfEditForm(request.data) if suffix: img = Parsing(img, suffix) user.img = img print(form.errors) if form.is_valid(): data = form.cleaned_data try: user.job = data['job'] user.username = data['username'] user.company = data['company'] user.addr = data['addr'] user.address_scale = data['address_scale'] user.plot_ratio = data['plot_ratio'] user.invest_pattern = data['invest_pattern'] user.land_nature = data['land_nature'] user.city = data['city'] user.area = data['area'] user.save() if user.usertype == '1': self_paiming = PaiMing.objects.filter( user_id=user.id).first() self_paiming.username = user.username self_paiming.save() print('排名添加成功') except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功', 'data': user.img}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): file_base = request.data.get('file_base') suffix = request.data.get('suffix') form = InvChargeMergeForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = None print(form.errors) if form.is_valid(): data = form.cleaned_data try: InvChargeMerge.objects.create( city=data['city'], area=data['area'], file_url=file_url, location=data['location'], serial_number=data['serial_number'], land_nature=data['land_nature'], land_area=data['land_area'], plot_ratio=data['plot_ratio'], building_density=data['building_density'], trading_type=data['trading_type'], deposit=data['deposit'], price=data['price'], deal_money=data['deal_money'], transferee_peo=data['transferee_peo'], licensor=data['licensor'], plan_conditions=data['plan_conditions'], trading_conditions=data['trading_conditions']) except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def put(self, request): b_id = request.data.get('id') big = BigData.objects.filter(id=b_id).first() file_base = request.data.get('file_base') suffix = request.data.get('suffix') file_url = request.data.get('file_url') form = BigDataForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = file_url print(form.errors) if form.is_valid(): data = form.cleaned_data try: big.city = data['city'], big.positioning = data['positioning'], big.city_card = data['city_card'], big.GDP = data['GDP'], big.peo_num = data['peo_num'], big.pillar_industries = data['pillar_industries'], big.key_enterprises = data['key_enterprises'], big.development_plan = data['development_plan'], big.planning_for = data['planning_for'], big.file_url = file_url big.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def put(self, request): land_id = request.data.get('land_id') poplist = PropertyList.objects.filter(id=land_id).first() luyou = request.data.get('luyou') file_base = request.data.get('file_base') suffix = request.data.get('suffix') img_base = request.data.get('img_base') img_suffix = request.data.get('img_suffix') form = PropertyInformationForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: if luyou == "/tudilist/nadi": property_types = 1 elif luyou == "/tudilist/gongdi": property_types = 2 elif luyou == "/tudilist/shoulou": property_types = 3 elif luyou == "/tudilist/loupan": property_types = 4 else: property_types = 0 poplist.title = data['title'] poplist.content = data['content'] if img_suffix: os.remove('/var/www/html/static/images/landimages/' + poplist.img) poplist.img = Parsing(img_base, img_suffix) poplist.desc = data['desc'] poplist.reward_price = data['reward_price'] poplist.information_source = data['information_source'] poplist.property_type = property_types if suffix: os.remove('/var/www/html/static/images/landimages/' + poplist.file_url) poplist.file_url = Parsing(file_base, suffix) poplist.file_introduction = data['file_introduction'] poplist.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): global property_type luyou = request.data.get('luyou') user_id = request.data.get('user_id') file_base = request.data.get('file_base') suffix = request.data.get('suffix') img_base = request.data.get('img_base') img_suffix = request.data.get('img_suffix') form = InvestmentInformationForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: if luyou == "/Investment/zhoubao": property_type = 1 elif luyou == "/Investment/yuebao": property_type = 2 elif luyou == "/Investment/jibao": property_type = 3 elif luyou == "/Investment/bannianbao": property_type = 4 elif luyou == "/Investment/nianbao": property_type = 5 else: pass img = Parsing(img_base, img_suffix) file_url = Parsing(file_base, suffix) invdata = InvestmentData.objects.create( title=data['title'], content=data['content'], img=img, desc=data['desc'], reward_price=data['reward_price'], information_source=data['information_source'], property_type=property_type, file_url=file_url, file_introduction=data['file_introduction']) ReleaseRecord.objects.create(user_id=user_id, land_id=invdata.id, luyou=luyou) except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): global activity_type luyou = request.data.get('luyou') user_id = request.data.get('user_id') img = request.data.get('img') suffix = request.data.get('suffix') form = ActivityInformationForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: if luyou == '/activity/shalong': activity_type = 1 elif luyou == '/activity/yuebao': activity_type = 2 elif luyou == '/activity/tuijie': activity_type = 3 elif luyou == '/activity/kuanian': activity_type = 4 else: pass img = Parsing(img, suffix) activity = Activity.objects.create( title=data['title'], content=data['content'], img=img, desc=data['desc'], reward_price=data['reward_price'], information_source=data['information_source'], activity_datetime=data['activity_datetime'], activity_place=data['activity_place'], activity_type=activity_type, content_feed=data['content_feed'], traffic_tips=data['traffic_tips'], quota=data['quota'], ) ReleaseRecord.objects.create(user_id=user_id, land_id=activity.id, luyou=luyou) except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def put(self, request): land_id = request.data.get('land_id') luyou = request.data.get('luyou') activity = Activity.objects.filter(id=land_id).first() img = request.data.get('img') suffix = request.data.get('suffix') form = ActivityInformationForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: if luyou == '/activity/shalong': activity_types = 1 elif luyou == '/activity/yuebao': activity_types = 2 elif luyou == '/activity/tuijie': activity_types = 3 elif luyou == '/activity/kuanian': activity_types = 4 else: activity_types = 0 activity.title = data['title'] activity.content = data['content'] if suffix: os.remove('/var/www/html/static/images/landimages/' + activity.img) activity.img = Parsing(img, suffix) activity.desc = data['desc'] activity.reward_price = data['reward_price'] activity.information_source = data['information_source'] activity.activity_datetime = data['activity_datetime'] activity.activity_place = data['activity_place'] activity.activity_type = activity_types activity.content_feed = data['content_feed'] activity.quota = data['quota'] activity.traffic_tips = data['traffic_tips'] activity.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def put(self, request): i_id = request.data.get('id') charge = InvChargeMerge.objects.filter(id=i_id).first() file_base = request.data.get('file_base') suffix = request.data.get('suffix') file_url = request.data.get('file_url') form = InvChargeMergeForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = file_url print(form.errors) if form.is_valid(): data = form.cleaned_data try: charge.city = data['city'] charge.area = data['area'] charge.file_url = file_url charge.location = data['location'] charge.serial_number = data['serial_number'] charge.land_nature = data['land_nature'] charge.land_area = data['land_area'] charge.plot_ratio = data['plot_ratio'] charge.building_density = data['building_density'] charge.trading_type = data['trading_type'] charge.deposit = data['deposit'] charge.price = data['price'] charge.deal_money = data['deal_money'] charge.transferee_peo = data['transferee_peo'] charge.licensor = data['licensor'] charge.plan_conditions = data['plan_conditions'] charge.trading_conditions = data['trading_conditions'] charge.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'}),
def post(self, request): user_id = request.data.get('user_id') img_data = [] img_lists = request.data.get('img_list') if img_lists: for img_list in img_lists: img_dic = {'status': 'success', 'uid': img_list['imgUid'], 'url': (Parsing(img_list['img64'], img_list['imgHZM']))} img_data.append(img_dic) user = Users.objects.filter(id=user_id).first() img = request.data.get('img') suffix_img = request.data.get('suffix_img') file_base = request.data.get('file_base') suffix = request.data.get('suffix') form = TransClientForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = None print(form.errors) if form.is_valid(): data = form.cleaned_data try: if img: img = Parsing(img, suffix_img) trans = TransInfo.objects.create(city=data['city'], area=data['area'], file_url=file_url, location=data['location'], serial_number=data['serial_number'], land_nature=data['land_nature'], land_area=data['land_area'], plot_ratio=data['plot_ratio'], reward_price=data['reward_price'], greening=data['greening'], building_density=data['building_density'], trading_type=data['trading_type'], deposit=data['deposit'], price=data['price'], people=data['people'], contact=data['contact'], licensor=data['licensor'], plan_conditions=data['plan_conditions'], trading_conditions=data['trading_conditions'], title=data['title'], content=data['content'], house_account=data['house_account'], remark=data['remark'], img=img, desc=data['desc'], information_source=user.company, img_list=img_data, information_validity=data['information_validity'], coordinates=data['coordinates'], pcc=data['pcc'], ) ReleaseRecord.objects.create(user_id=user_id, land_id=trans.id, luyou='/tudimessage/zhuanrang') except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功', 'id': trans.id}) return Response({'status': '0', 'msg': '数据不完整', 'data': form.errors})
def put(self, request): land_id = request.data.get('land_id') img_data = [] img_verifys = request.data.get('img_verify') if img_verifys: for img_verify in img_verifys: img_verify_dic = {'status': img_verify['status'], 'uid': img_verify['uid'], 'url': img_verify['url'].split('/')[-1]} img_data.append(img_verify_dic) img_lists = request.data.get('img_list') if img_lists: for img_list in img_lists: img_dic = {'status': 'success', 'uid': img_list['imgUid'], 'url': (Parsing(img_list['img64'], img_list['imgHZM']))} img_data.append(img_dic) luyou = request.data.get('luyou') land = LandInfo.objects.filter(id=land_id).first() if land.img_list: for i in eval(land.img_list): if i not in img_data: os.remove('/var/www/html/static/images/landimages/' + i['url']) file_base = request.data.get('file_base') suffix = request.data.get('suffix') img_base = request.data.get('img_base') img_suffix = request.data.get('img_suffix') form = NoticeClientForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: land.city = data['city'] land.area = data['area'] if suffix: if land.file_url: os.remove('/var/www/html/static/images/landimages/' + land.file_url) land.file_url = Parsing(file_base, suffix) land.location = data['location'] land.serial_number = data['serial_number'] land.advance_date = data['advance_date'] land.listed_date = data['listed_date'] land.transfer_date = data['transfer_date'] land.land_nature = data['land_nature'] land.land_area = data['land_area'] land.plot_ratio = data['plot_ratio'] land.greening = data['greening'] land.building_density = data['building_density'] land.transfer_mode = data['transfer_mode'] land.margin = data['margin'] land.reward_price = data['reward_price'] land.start_price = data['start_price'] land.transfer_high_price = data['transfer_high_price'] land.plan_condition = data['plan_condition'] land.remark = data['remark'] land.house_account = data['house_account'] land.c_f = data['c_f'] land.title = data['title'] land.content = data['content'] land.img_list = img_data print(111) land.yuji_guapai = data['yuji_guapai'] land.now_progress = data['now_progress'] land.add_amplitude = data['add_amplitude'] land.special_requirements = data['special_requirements'] land.coordinates = data['coordinates'] land.pcc = data['pcc'] if img_suffix: if land.img: os.remove('/var/www/html/static/images/landimages/' + land.img) land.img = Parsing(img_base, img_suffix) land.desc = data['desc'] if luyou == '/tudimessage/nitui': land.land_type = 2 elif luyou == '/tudimessage/guapai': land.land_type = 1 elif luyou == '/tudimessage/paimai': land.land_type = 3 elif luyou == '/tudimessage/xiancheng': land.land_type = 4 else: land.land_type = 5 land.create_on = datetime.datetime.now() land.audit_state = 0 land.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def put(self, request): land_id = request.data.get('land_id') img_data = [] img_verifys = request.data.get('img_verify') if img_verifys: for img_verify in img_verifys: img_verify_dic = {'status': img_verify['status'], 'uid': img_verify['uid'], 'url': img_verify['url'].split('/')[-1]} img_data.append(img_verify_dic) # a_data.append(img_verify_dic) img_lists = request.data.get('img_list') if img_lists: for img_list in img_lists: img_dic = {'status': 'success', 'uid': img_list['imgUid'], 'url': (Parsing(img_list['img64'], img_list['imgHZM']))} img_data.append(img_dic) trans = TransInfo.objects.filter(id=land_id).first() if trans.img_list: for i in eval(trans.img_list): if i not in img_data: os.remove('/var/www/html/static/images/landimages/' + i['url']) file_base = request.data.get('file_base') suffix = request.data.get('suffix') img_base = request.data.get('img_base') img_suffix = request.data.get('img_suffix') form = TransClientForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: trans.city = data['city'] trans.area = data['area'] if suffix: if trans.file_url: os.remove('/var/www/html/static/images/landimages/' + trans.file_url) trans.file_url = Parsing(file_base, suffix) trans.location = data['location'] trans.serial_number = data['serial_number'] trans.land_nature = data['land_nature'] trans.land_area = data['land_area'] trans.plot_ratio = data['plot_ratio'] trans.greening = data['greening'] trans.reward_price = data['reward_price'] trans.building_density = data['building_density'] trans.trading_type = data['trading_type'] trans.deposit = data['deposit'] trans.price = data['price'] trans.people = data['people'] trans.contact = data['contact'] trans.licensor = data['licensor'] trans.plan_conditions = data['plan_conditions'] trans.trading_conditions = data['trading_conditions'] trans.title = data['title'] trans.house_account = data['house_account'] trans.remark = data['remark'] trans.content = data['content'] trans.coordinates = data['coordinates'] trans.pcc = data['pcc'] if img_suffix: if trans.img: os.remove('/var/www/html/static/images/landimages/' + trans.img) trans.img = Parsing(img_base, img_suffix) trans.desc = data['desc'] trans.img_list = img_data trans.information_validity = data['information_validity'] trans.create_on = datetime.datetime.now() trans.audit_state = 0 trans.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})
def post(self, request): user_id = request.data.get('user_id') # 存放多张图片信息 img_data = [] img_lists = request.data.get('img_list') if img_lists: for img_list in img_lists: img_dic = {'status': 'success', 'uid': img_list['imgUid'], 'url': (Parsing(img_list['img64'], img_list['imgHZM']))} img_data.append(img_dic) user = Users.objects.filter(id=user_id).first() luyou = request.data.get('luyou') img = request.data.get('img') suffix_img = request.data.get('suffix_img') if suffix_img: img = Parsing(img, suffix_img) file_base = request.data.get('file_base') suffix = request.data.get('suffix') form = NoticeClientForm(request.data) if suffix: file_url = Parsing(file_base, suffix) else: file_url = None print(form.errors) if form.is_valid(): data = form.cleaned_data try: if luyou == '/tudimessage/nitui': land_type = 2 elif luyou == '/tudimessage/guapai': land_type = 1 elif luyou == '/tudimessage/paimai': land_type = 3 elif luyou == '/tudimessage/xiancheng': land_type = 4 else: land_type = 5 land = LandInfo.objects.create(city=data['city'], land_type=land_type, area=data['area'], file_url=file_url, location=data['location'], serial_number=data['serial_number'], advance_date=data['advance_date'], listed_date=data['listed_date'], transfer_date=data['transfer_date'], land_nature=data['land_nature'], land_area=data['land_area'], plot_ratio=data['plot_ratio'], greening=data['greening'], building_density=data['building_density'], transfer_mode=data['transfer_mode'], margin=data['margin'], start_price=data['start_price'], transfer_high_price=data['transfer_high_price'], plan_condition=data['plan_condition'], remark=data['remark'], c_f=data['c_f'], title=data['title'], house_account=data['house_account'], content=data['content'], reward_price=data['reward_price'], img=img, desc=data['desc'], information_source=user.company, img_list=img_data, yuji_guapai=data['yuji_guapai'], now_progress=data['now_progress'], add_amplitude=data['add_amplitude'], special_requirements=data['special_requirements'], coordinates=data['coordinates'], pcc=data['pcc'], ) ReleaseRecord.objects.create(user_id=user_id, land_id=land.id, luyou=luyou) except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功', 'id': land.id}) return Response({'status': '0', 'msg': '数据不完整', 'data': form.errors})
def put(self, request): land_id = request.data.get('land_id') img_data = [] img_verifys = request.data.get('img_verify') if img_verifys: for img_verify in img_verifys: img_verify_dic = {'status': img_verify['status'], 'uid': img_verify['uid'], 'url': img_verify['url'].split('/')[-1]} img_data.append(img_verify_dic) img_lists = request.data.get('img_list') if img_lists: for img_list in img_lists: img_dic = {'status': 'success', 'uid': img_list['imgUid'], 'url': (Parsing(img_list['img64'], img_list['imgHZM']))} img_data.append(img_dic) attract = AttractInfo.objects.filter(id=land_id).first() if attract.img_list: for i in eval(attract.img_list): if i not in img_data: os.remove('/var/www/html/static/images/landimages/' + i['url']) file_base = request.data.get('file_base') suffix = request.data.get('suffix') img_base = request.data.get('img_base') img_suffix = request.data.get('img_suffix') form = AttractClientForm(request.data) print(form.errors) if form.is_valid(): data = form.cleaned_data try: attract.city = data['city'] attract.area = data['area'] if suffix: if attract.file_url: os.remove('/var/www/html/static/images/landimages/' + attract.file_url) attract.file_url = Parsing(file_base, suffix) attract.location = data['location'] attract.serial_number = data['serial_number'] attract.land_nature = data['land_nature'] attract.land_area = data['land_area'] attract.cooperate_condition = data['cooperate_condition'] attract.people = data['people'] attract.contact = data['contact'] attract.notice_date = data['notice_date'] attract.total_inv = data['total_inv'] attract.house_account = data['house_account'] attract.title = data['title'] attract.content = data['content'] attract.remark = data['remark'] attract.reward_price = data['reward_price'] attract.plot_ratio = data['plot_ratio'] attract.coordinates = data['coordinates'] attract.pcc = data['pcc'] if img_suffix: if attract.img: os.remove('/var/www/html/static/images/landimages/' + attract.img) attract.img = Parsing(img_base, img_suffix) attract.desc = data['desc'] attract.img_list = img_data attract.industry_requirements = data['industry_requirements'] attract.create_on = datetime.datetime.now() attract.audit_state = 0 attract.save() except: return Response({'status': '0', 'msg': '创建失败'}) return Response({'status': '1', 'msg': '编辑成功'}) return Response({'status': '0', 'msg': '数据不完整'})