def roomassign(): ''' 숙소 배정 ''' if request.method == 'POST': member_list = request.form.getlist('member_idx') room_idx = request.form.get('room_idx') for member_idx in member_list: member = db.session.query(Member).filter( Member.idx == member_idx).one() member.room_idx = room_idx db.session.commit() next_url = request.args.get('next') if next_url is not None: return redirect(next_url) else: return redirect(url_for('.roomassign')) camp_idx = Camp.get_idx(campcode) query = db.session.query(Member) if campcode == 'cmc' or campcode == 'cbtj': cmc_idx = Camp.get_idx('cmc') cbtj_idx = Camp.get_idx('cbtj') room_stat = Room.get_stat(camp_idx=[cmc_idx, cbtj_idx]) filtered_query = query.filter( or_(Member.camp_idx == cmc_idx, Member.camp_idx == cbtj_idx)) room_list = db.session.query(Roomsetting).filter( Roomsetting.camp_idx == cmc_idx).all() else: filtered_query = query.filter(Member.camp_idx == camp_idx) room_stat = Room.get_stat(camp_idx=camp_idx) room_list = db.session.query(Roomsetting).filter( Roomsetting.camp_idx == camp_idx).all() filtered_query = get_member_list_query( filtered_query, request, orderby=['camp_idx', 'sex', 'area_idx']) page = int(request.args.get('page', 1)) member_list = filtered_query.limit(50).offset((page - 1) * 50).all() count = filtered_query.count() area_list = Area.get_list(campcode) group_list = db.session.query(Group).filter( Group.camp_idx == camp_idx).all() return render_template('%s/room_assign.html' % campcode, room_list=room_list, members=member_list, count=count - (page - 1) * 50, nav=range(1, int(count / 50) + 2), area_list=area_list, group_list=group_list, room_stat=room_stat)
def room(): ''' 숙소 현황 ''' if request.method == 'POST': member_list = request.form.getlist('member_idx') for member_idx in member_list: member = db.session.query(Member).filter(Member.idx == member_idx).one() member.room_idx = None db.session.commit() next_url = request.args.get('next') if next_url is not None: return redirect(next_url) else: return redirect(url_for('.room')) else: camp_idx = Camp.get_idx(campcode) query = db.session.query(Member) if campcode == 'cmc' or campcode == 'cbtj': cmc_idx = Camp.get_idx('cmc') cbtj_idx = Camp.get_idx('cbtj') filtered_query = query.filter(or_(Member.camp_idx == cmc_idx, Member.camp_idx == cbtj_idx)) room_stat = Room.get_stat(camp_idx=[cmc_idx, cbtj_idx]) room_list = db.session.query(Roomsetting).filter(Roomsetting.camp_idx == cmc_idx).all() else: filtered_query = query.filter(Member.camp_idx == camp_idx) room_stat = Room.get_stat(camp_idx=camp_idx) room_list = db.session.query(Roomsetting).filter(Roomsetting.camp_idx == camp_idx).all() filtered_query = get_member_list_query(filtered_query, request, orderby=['camp_idx', 'sex', 'area_idx']) page = int(request.args.get('page', 1)) # filtered_query = filtered_query.limit(50).offset((page - 1) * 50) if request.args.get('room_idx', None) is not None: # member_list = filtered_query.limit(50).offset((page - 1) * 50).all() member_list = filtered_query.all() count = filtered_query.count() else: member_list = [] count = 0 area_list = Area.get_list(campcode) group_list = db.session.query(Group).filter(Group.camp_idx == camp_idx).all() return render_template('%s/room.html' % campcode, room_list=room_list, members=member_list, count=count, area_list=area_list, group_list=group_list, room_stat=room_stat)
def populate_membership(self, member_idx): ''' member의 가변필드인 membership 테이블에 폼의 내용을 업데이트함. ''' camp_idx = Camp.get_idx(self.camp) membership_fields = form_config.MEMBERSHIP_FIELDS[self.camp] for membership_field in membership_fields: if membership_field == 'route': for route in getattr(self, membership_field).data: r_membership = Membership() r_membership.camp_idx = camp_idx r_membership.member_idx = member_idx r_membership.key = 'route' r_membership.value = route db.session.add(r_membership) else: if getattr(self, membership_field).data not in [None, '', 'none']: membership = Membership() membership.camp_idx = camp_idx membership.member_idx = member_idx membership.key = membership_field membership.value = getattr(self, membership_field).data db.session.add(membership) if self.camp != 'ga': if self.training.data not in [None, '', 'None']: for training in self.training.data: t_membership = Membership() t_membership.camp_idx = camp_idx t_membership.member_idx = member_idx t_membership.key = 'training' t_membership.value = training db.session.add(t_membership) db.session.commit()
def save_promotion_info(): '''홍보물 신청''' camp_idx = Camp.get_idx(campcode) church_name = request.form.get('church_name', None) name = request.form.get('name', None) address = request.form.get('address', None) contact = request.form.get('contact', None) memo = request.form.get('memo', None) next_url = request.form.get('next', None) promotion = Promotion() promotion.camp_idx = camp_idx promotion.church_name = church_name promotion.name = name promotion.address = address promotion.contact = contact promotion.memo = memo db.session.add(promotion) db.session.commit() flash('홍보물 신청이 완료되었습니다') if next_url is not None: return redirect(next_url) else: return redirect(url_for('.home'))
def fix_attend_error(): ''' 참가기간 통계표 수정 ''' Member.fix_attend_error(Camp.get_idx(campcode)) next_url = request.args.get('next', url_for('.home')) return redirect(next_url)
def promotion_list(): ''' 홍보물 신청 리스트 ''' camp_idx = Camp.get_idx(campcode) promotion_list = db.session.query(Promotion).filter(Promotion.camp_idx == camp_idx).all() return render_template('%s/promotion_list.html' % campcode, promotions=promotion_list)
def populate_obj(self, member): ''' 폼의 내용으로 member 모델 객체의 내용을 채움''' member.name = self.name.data if self.camp != 'ga': if self.group_yn is False: member.area_idx = self.area_idx.data else: member.area_idx = self.group_area_idx member.contact = request.form.get('hp') + '-' + request.form.get('hp2') + '-' + request.form.get('hp3') member.church = self.church.data if self.camp != 'ga': member.birth = self.birth.data member.sex = self.sex.data if self.camp != 'ga': member.bus_yn = self.bus_yn.data if self.bus_yn not in [None, 'None', '', 'none', 'null'] else 0 member.mit_yn = self.mit_yn.data if self.mit_yn not in [None, 'None', '', 'none', 'null'] else 0 member.attend_yn = 0 if self.camp != 'ga': member.newcomer_yn = self.newcomer_yn.data member.persontype = self.persontype.data # added by Moon 2017.4.5 #if self.camp == 'cmc' or self.camp == 'cbtj': # member.military = self.military.data member.fullcamp_yn = self.fullcamp_yn.data if self.fullcamp_yn not in [None, 'None', '', 'none', 'null'] else 1 if self.camp == 'kids' or self.camp == 'kidskids' or self.fullcamp_yn.data == "1": date_list = Camp.get_date_list(member.camp_idx) member.date_of_arrival = datetime.datetime.strftime(date_list[0][0], "%Y-%m-%d") member.date_of_leave = datetime.datetime.strftime(date_list[-1][0], "%Y-%m-%d") else: member.date_of_arrival = self.date_of_arrival.data member.date_of_leave = self.date_of_leave.data member.language = self.language.data member.memo = self.memo.data
def insert(self): ''' 폼의 내용을 가지고 member테이블에 신규 행을 삽입함. ''' member = Member() member.camp_idx = Camp.get_idx(self.camp) if self.group_yn is False: member.userid = self.userid.data member.pwd = hashlib.sha224(self.pwd.data.encode('utf-8')).hexdigest() else: member.group_idx = self.group_idx self.populate_obj(member) member.regdate = datetime.datetime.today() member.canceldate = None member.cancel_yn = 0 member.cancel_reason = None member.room_idx = None member.smallgroup_num = None if member.mit_yn is None or member.mit_yn == 'None': member.mit_yn = 0 attend = member.get_attend_array() member.attend1, member.attend2, member.attend3, member.attend4 = attend db.session.add(member) db.session.commit() self.populate_membership(member.idx) return member.idx
def insert(self): ''' 폼의 내용을 가지고 member테이블에 신규 행을 삽입함. ''' member = Member() member.camp_idx = Camp.get_idx(self.camp) if self.group_yn is False: member.userid = self.userid.data member.pwd = hashlib.sha224( self.pwd.data.encode('utf-8')).hexdigest() else: member.group_idx = self.group_idx self.populate_obj(member) member.regdate = datetime.datetime.today() member.canceldate = None member.cancel_yn = 0 member.cancel_reason = None member.room_idx = None member.smallgroup_num = None if member.mit_yn is None or member.mit_yn == 'None': member.mit_yn = 0 attend = member.get_attend_array() member.attend1, member.attend2, member.attend3, member.attend4 = attend db.session.add(member) db.session.commit() self.populate_membership(member.idx) return member.idx
def home(): ''' 각 캠프의 전체 통계를 보여주는 페이지 ''' year = int(request.args.get('year', 0)) term = int(request.args.get('term', 0)) camp_idx = Camp.get_idx(campcode, year, term) area_idx = request.args.get('area_idx', None) if area_idx is not None and area_idx != current_user.area_idx and campcode != 'ga': area_idx = current_user.area_idx stat = statistics.get_stat(camp_idx, area_idx=area_idx) attend_stat = Member.get_attend_stat(camp_idx) partial_stat = Member.get_partial_stat(camp_idx) fromdate = datetime.datetime.strftime(datetime.datetime.today() - datetime.timedelta(days=20), "%Y-%m-%d") query = """ SELECT DATE(regdate) AS ForDate, COUNT(*) AS NumMembers FROM member WHERE regdate >= '{0}' AND camp_idx = {1} GROUP BY DATE(regdate) ORDER BY ForDate """.format(fromdate, camp_idx) daily_apply = db.session.execute(query) chart = None import sys sys.stderr.write(str(stat)) return render_template('{0}/home.html'.format(campcode), stat=stat, metrics=metrics, attend_stat=attend_stat, partial_stat=partial_stat, chart=chart, daily_apply=daily_apply)
def promotion_list(): ''' 홍보물 신청 리스트 ''' camp_idx = Camp.get_idx(campcode) promotion_list = db.session.query(Promotion).filter( Promotion.camp_idx == camp_idx).all() return render_template('%s/promotion_list.html' % campcode, promotions=promotion_list)
def member_list(): ''' 신청자목록 ''' year = request.args.get('year', 0) term = request.args.get('term', 0) camp_idx = Camp.get_idx(campcode, year, term) receptionmode = request.args.get('receptionmode', False) query = db.session.query(Member) if (campcode == 'cmc' or campcode == 'cbtj') and receptionmode: cmc_idx = Camp.get_idx('cmc') cbtj_idx = Camp.get_idx('cbtj') filtered_query = query.filter( or_(Member.camp_idx == cmc_idx, Member.camp_idx == cbtj_idx)) else: filtered_query = query.filter(Member.camp_idx == camp_idx) filtered_query = get_member_list_query(filtered_query, request) # pagination page = int(request.args.get('page', 1)) count = filtered_query.count() filtered_query = filtered_query.limit(50).offset((page - 1) * 50) member_list = filtered_query.all() group_idx = request.args.get('group_idx', None) if group_idx not in [None, '', 'none', 'not_none']: group = db.session.query(Group).filter( Group.idx == group_idx).one() else: group = None area_list = Area.get_list(campcode) group_list = db.session.query(Group).filter( Group.camp_idx == camp_idx).all() return render_template('%s/list.html' % campcode, members=member_list, group=group, count=count - (page - 1) * 50, nav=range(1, int(count / 50) + 2), area_list=area_list, group_list=group_list)
def room_check(): '''숙소확인''' form = RoomCheckForm(request.form) camp_idx = Camp.get_idx(campcode) if request.method == 'POST': contact = "{0}-{1}-{2}".format( request.form.get('hp', ''), request.form.get('hp2', ''), request.form.get('hp3', '') ) name = request.form.get('name', '') logintype = request.form.get('logintype', '') if logintype == '개인': try: member = db.session.query(Member).filter( Member.name == name, Member.contact == contact, Member.camp_idx == camp_idx ).one() camp = db.session.query(Camp).filter(Camp.idx == camp_idx).one() return render_template('{0}/room-check-result.html'.format(campcode), name=member.name, camp=camp.name, member=member, msg=None, member_list=None) except MultipleResultsFound: return render_template('{0}/room-check-result.html'.format(campcode), name=None, camp=None, msg='중복신청오류입니다. 등록대에 문의해주세요.', member_list=None) except NoResultFound: return render_template('{0}/room-check-result.html'.format(campcode), name=None, camp=None, msg='신청자 정보가 없습니다.', member_list=None) elif logintype == '단체': try: group = db.session.query(Group).filter( Group.leadername == name, Group.leadercontact == contact, Group.camp_idx == camp_idx ).one() camp = db.session.query(Camp).filter(Camp.idx == camp_idx).one() member_list = db.session.query(Member).filter(Member.group_idx == group.idx).all() return render_template('{0}/room-check-result.html'.format(campcode), name=group.name, camp=camp.name, room=None, member_list=member_list) except MultipleResultsFound: return render_template('{0}/room-check-result.html'.format(campcode), name=None, camp=None, room=None, msg='중복신청오류입니다. 등록대에 문의해주세요.') except NoResultFound: return render_template('{0}/room-check-result.html'.format(campcode), name=None, camp=None, room=None, msg='신청 단체 정보가 없습니다.') return render_template('{0}/room-check.html'.format(campcode), form=form)
def member_list(): ''' 신청자목록 ''' year = request.args.get('year', 0) term = request.args.get('term', 0) camp_idx = Camp.get_idx(campcode, year, term) receptionmode = request.args.get('receptionmode', False) query = db.session.query(Member) if (campcode == 'cmc' or campcode == 'cbtj') and receptionmode: cmc_idx = Camp.get_idx('cmc') cbtj_idx = Camp.get_idx('cbtj') filtered_query = query.filter(or_(Member.camp_idx == cmc_idx, Member.camp_idx == cbtj_idx)) else: filtered_query = query.filter(Member.camp_idx == camp_idx) filtered_query = get_member_list_query(filtered_query, request) # pagination page = int(request.args.get('page', 1)) count = filtered_query.count() filtered_query = filtered_query.limit(50).offset((page - 1) * 50) member_list = filtered_query.all() group_idx = request.args.get('group_idx', None) if group_idx not in [None, '', 'none', 'not_none']: group = db.session.query(Group).filter(Group.idx == group_idx).one() else: group = None area_list = Area.get_list(campcode) group_list = db.session.query(Group).filter(Group.camp_idx == camp_idx).all() return render_template('%s/list.html' % campcode, members=member_list, group=group, count=count - (page - 1) * 50, nav=range(1, int(count / 50) + 2), area_list=area_list, group_list=group_list)
def excel_down(): ''' 엑셀다운로드 ''' year = request.args.get('year', 0) term = request.args.get('term', 0) camp_idx = Camp.get_idx(campcode, year=year, term=term) query = db.session.query(Member) filtered_query = query.filter(Member.camp_idx == camp_idx) filtered_query = get_member_list_query(filtered_query, request) member_list = filtered_query.all() xlsx_builder = XlsxBuilder() output = xlsx_builder.get_document(campcode, member_list) response = make_response(output.read()) response.headers["Content-Disposition"] = "attachment; filename=member.xlsx" return response
def reg_group(): '''단체신청''' form = GroupForm(request.form) form.set_camp(campcode) if request.method == "POST": group_idx = form.insert(Camp.get_idx(campcode)) session['type'] = '단체' session['idx'] = group_idx flash('신청이 완료되었습니다.') return redirect(url_for('.group_info')) script_file = 'common/js/reg-group.js' return render_template('{0}/form.html'.format(campcode), form=form, page_header="단체신청", script=url_for('static', filename=script_file))
def excel_down(): ''' 엑셀다운로드 ''' year = request.args.get('year', 0) term = request.args.get('term', 0) camp_idx = Camp.get_idx(campcode, year=year, term=term) query = db.session.query(Member) filtered_query = query.filter(Member.camp_idx == camp_idx) filtered_query = get_member_list_query(filtered_query, request) member_list = filtered_query.all() xlsx_builder = XlsxBuilder() output = xlsx_builder.get_document(campcode, member_list) response = make_response(output.read()) response.headers[ "Content-Disposition"] = "attachment; filename=member.xlsx" return response
def populate_obj(self, member): ''' 폼의 내용으로 member 모델 객체의 내용을 채움''' member.name = self.name.data if self.camp != 'ga': if self.group_yn is False: member.area_idx = self.area_idx.data else: member.area_idx = self.group_area_idx member.contact = request.form.get('hp') + '-' + request.form.get( 'hp2') + '-' + request.form.get('hp3') member.church = self.church.data if self.camp != 'ga': member.birth = self.birth.data member.sex = self.sex.data if self.camp != 'ga': member.bus_yn = self.bus_yn.data if self.bus_yn not in [ None, 'None', '', 'none', 'null' ] else 0 member.mit_yn = self.mit_yn.data if self.mit_yn not in [ None, 'None', '', 'none', 'null' ] else 0 member.attend_yn = 0 if self.camp != 'ga': member.newcomer_yn = self.newcomer_yn.data member.persontype = self.persontype.data # added by Moon 2017.4.5 #if self.camp == 'cmc' or self.camp == 'cbtj': # member.military = self.military.data member.fullcamp_yn = self.fullcamp_yn.data if self.fullcamp_yn not in [ None, 'None', '', 'none', 'null' ] else 1 if self.camp == 'kids' or self.fullcamp_yn.data == "1": date_list = Camp.get_date_list(member.camp_idx) member.date_of_arrival = datetime.datetime.strftime( date_list[0][0], "%Y-%m-%d") member.date_of_leave = datetime.datetime.strftime( date_list[-1][0], "%Y-%m-%d") else: member.date_of_arrival = self.date_of_arrival.data member.date_of_leave = self.date_of_leave.data member.language = self.language.data member.memo = self.memo.data
def roomsetting(): ''' 캠프별 숙소 셋팅 ''' if request.method == 'POST': params = request.form.to_dict() for key, value in params.items(): k = key.split('-') roomsetting = db.session.query(Roomsetting).filter(Roomsetting.idx == k[1]).one() setattr(roomsetting, k[0], value) db.session.commit() # roomsetting.save() camp_idx = Camp.get_idx(campcode) room_list = db.session.query(Roomsetting).filter(Roomsetting.camp_idx == camp_idx).all() if room_list is None or len(room_list) == 0: Roomsetting.init(camp_idx) room_list = db.session.query(Roomsetting).filter(Roomsetting.camp_idx == camp_idx).all() return render_template('%s/room_setting.html' % campcode, room_list=room_list)
def home(): ''' 각 캠프의 전체 통계를 보여주는 페이지 ''' year = int(request.args.get('year', 0)) term = int(request.args.get('term', 0)) camp_idx = Camp.get_idx(campcode, year, term) area_idx = request.args.get('area_idx', None) if area_idx is not None and area_idx != current_user.area_idx and campcode != 'ga': area_idx = current_user.area_idx stat = statistics.get_stat(camp_idx, area_idx=area_idx) attend_stat = Member.get_attend_stat(camp_idx) partial_stat = Member.get_partial_stat(camp_idx) fromdate = datetime.datetime.strftime( datetime.datetime.today() - datetime.timedelta(days=20), "%Y-%m-%d") query = """ SELECT DATE(regdate) AS ForDate, COUNT(*) AS NumMembers FROM member WHERE regdate >= '{0}' AND camp_idx = {1} GROUP BY DATE(regdate) ORDER BY ForDate """.format(fromdate, camp_idx) daily_apply = db.session.execute(query) chart = None import sys sys.stderr.write(str(stat)) return render_template('{0}/home.html'.format(campcode), stat=stat, metrics=metrics, attend_stat=attend_stat, partial_stat=partial_stat, chart=chart, daily_apply=daily_apply)
def login(): '''신청 조회 / 로그인하기.''' if request.method == 'POST': logintype = request.form.get('logintype', None) userid = request.form.get('userid', None) pwd = request.form.get('pwd', None) if logintype == '' or logintype is None: flash('신청 구분을 선택해주세요') elif userid == '' or userid is None: flash('아이디를 입력해주세요') elif pwd == '' or pwd is None: flash('비밀번호를 입력해 주세요') else: campidx = Camp.get_idx(campcode) if logintype == '개인': if Member.login_check(campidx, userid, pwd): idx = db.session.query(Member).filter(Member.camp_idx == campidx, Member.userid == userid, Member.cancel_yn == 0).one().idx session['type'] = '개인' session['idx'] = idx return redirect(url_for('.member_info')) else: flash('아이디 또는 비밀번호가 잘못되었습니다.') elif logintype == '단체': if Group.login_check(campidx, userid, pwd): idx = db.session.query(Group).filter(Group.camp_idx == campidx, Group.groupid == userid, Group.cancel_yn == 0).one().idx session['type'] = '단체' session['idx'] = idx return redirect(url_for('.group_info')) else: flash('아이디 또는 비밀번호가 잘못되었습니다.') return redirect(url_for('.login')) return render_template('{0}/check.html'.format(campcode))
def roomsetting(): ''' 캠프별 숙소 셋팅 ''' if request.method == 'POST': params = request.form.to_dict() for key, value in params.items(): k = key.split('-') roomsetting = db.session.query(Roomsetting).filter( Roomsetting.idx == k[1]).one() setattr(roomsetting, k[0], value) db.session.commit() # roomsetting.save() camp_idx = Camp.get_idx(campcode) room_list = db.session.query(Roomsetting).filter( Roomsetting.camp_idx == camp_idx).all() if room_list is None or len(room_list) == 0: Roomsetting.init(camp_idx) room_list = db.session.query(Roomsetting).filter( Roomsetting.camp_idx == camp_idx).all() return render_template('%s/room_setting.html' % campcode, room_list=room_list)
def set_camp(self, camp): ''' 어떤 캠프의 신청폼인지 지정해줌. ''' self.camp = camp self.date_of_arrival.choices = Camp.get_date_list(Camp.get_idx(camp)) self.date_of_leave.choices = Camp.get_date_list(Camp.get_idx(camp)) if camp != 'ga': self.address.widget = HiddenInput() self.location.widget = HiddenInput() self.city.widget = HiddenInput() self.etclanguage.widget = HiddenInput() self.enname.widget = HiddenInput() self.etcperson.widget = HiddenInput() self.denomination.widget = HiddenInput() self.area_idx.choices = Area.get_list(camp) self.persontype.choices = [(i, i) for i in form_config.PERSONTYPES[camp]] self.training.choices = form_config.TRAININGS[camp] if camp != 'cbtj': self.job_name.widget = HiddenInput() if camp != 'cmc': self.campus.widget = HiddenInput() self.major.widget = HiddenInput() # added by Moon 2017.4.5 #if camp not in ['cmc', 'cbtj'] or self.job_name != '군인': # self.military.widget =HiddenInput() # if camp in ['cmc', 'cbtj']: self.job.choices = [(i, i) for i in form_config.JOBS] else: self.vision_yn.widget = HiddenInput() self.mit_yn.widget = HiddenInput() if camp not in ['ws', 'kids', 'kidskids']: self.pname.widget = HiddenInput() else: self.userid.label = '아이디' if camp != 'ws': self.stafftype.widget = HiddenInput() else: self.job.label = '교회 직분' self.job.choices = [(i, i) for i in form_config.CHURCH_JOBS] self.stafftype.choices = form_config.STAFF_TYPES[camp] if camp not in ['cbtj', 'cmc', 'ws']: self.job.widget = HiddenInput() if camp not in ['kids', 'youth']: self.sch1.widget = HiddenInput() self.sch2.widget = HiddenInput() else: self.sch2.choices = form_config.SCH2_CHOICES[camp] if camp == 'kids' or camp == 'kidskids': '''self.bus_yn.widget = HiddenInput()''' self.language.widget = HiddenInput() self.fullcamp_yn.widget = HiddenInput() self.date_of_arrival.widget = HiddenInput() self.date_of_leave.widget = HiddenInput() if camp == 'youth' or camp == 'cbtj' or camp == 'cmc': self.route.choices = form_config.ROUTES[camp] else: self.route.widget = HiddenInput() else: # camp == 'ga' self.userid.widget = HiddenInput() self.area_idx.widget = HiddenInput() self.pwd.widget = HiddenInput() self.pwd2.widget = HiddenInput() self.birth.widget = HiddenInput() self.stafftype.widget = HiddenInput() self.job.widget = HiddenInput() self.job_name.widget = HiddenInput() self.campus.widget = HiddenInput() self.major.widget = HiddenInput() self.sch1.widget = HiddenInput() self.sch2.widget = HiddenInput() self.bus_yn.widget = HiddenInput() self.newcomer_yn.widget = HiddenInput() self.vision_yn.widget = HiddenInput() self.training.widget = HiddenInput() self.route.label = 'GA를 알게된 경로' self.route.choices = [ ('주변사람들의 추천', "주변사람들의 추천"), ('언론매체 및 홍보물', "언론매체 및 홍보물"), ('인터콥소속 선교사 파송교회', "인터콥소속 선교사 파송교회"), ('인터콥 협력교회', "인터콥 협력교회"), ('목선협', "목선협"), ('목회자 비전스쿨', "목회자 비전스쿨"), ('기타', "기타"), ] self.mit_yn.label = "비전캠프 참석 여부" self.persontype.choices = [('목회자', '목회자'), ('비목회자', '비목회자')] self.language.choices = [('필요 없음', '필요 없음'), ('영어', '영어'), ('중국어', '중국어'), ('그 외 언어', '그 외 언어')]
def check_groupid(): '''단체아이디 중복체크''' campidx = Camp.get_idx(campcode) userid = request.form.get('groupid') return "%d" % Group.check_groupid(campidx, userid)
def check_userid(): '''아이디 중복체크''' campidx = Camp.get_idx(campcode) userid = request.form.get('userid') return "%d" % Member.check_userid(campidx, userid)
'''청년대학생 선교캠프 단위 테스트''' import unittest from core.database import DB as db from core.models import Member, Membership, Payment, Camp, Group from missioncamp.app import APP as app CMC_CAMP_IDX = Camp.get_idx('cmc') INDIVIDUAL_SAMPLE_DATA = dict(userid="*****@*****.**", pwd="123", pwd2="123", name="123", area_idx="1", sex="M", birth="1988", hp="010", hp2="1234", hp3="1234", contact="010-1234-1234", church="123", persontype="청년", bus_yn="1", mit_yn="1", fullcamp_yn="1", newcomer_yn="0", vision_yn="1", training=["비전스쿨", "선교캠프"], language="", memo="") INDIVIDUAL_EDIT_DATA = dict(pwd="456",
def set_camp(self, camp): ''' 어떤 캠프의 신청폼인지 지정해줌. ''' self.camp = camp self.date_of_arrival.choices = Camp.get_date_list(Camp.get_idx(camp)) self.date_of_leave.choices = Camp.get_date_list(Camp.get_idx(camp)) if camp != 'ga': self.address.widget = HiddenInput() self.location.widget = HiddenInput() self.city.widget = HiddenInput() self.etclanguage.widget = HiddenInput() self.enname.widget = HiddenInput() self.etcperson.widget = HiddenInput() self.denomination.widget = HiddenInput() self.area_idx.choices = Area.get_list(camp) self.persontype.choices = [(i, i) for i in form_config.PERSONTYPES[camp]] self.training.choices = form_config.TRAININGS[camp] if camp != 'cbtj': self.job_name.widget = HiddenInput() if camp != 'cmc': self.campus.widget = HiddenInput() self.major.widget = HiddenInput() # added by Moon 2017.4.5 #if camp not in ['cmc', 'cbtj'] or self.job_name != '군인': # self.military.widget =HiddenInput() # if camp in ['cmc', 'cbtj']: self.job.choices = [(i, i) for i in form_config.JOBS] else: self.vision_yn.widget = HiddenInput() self.mit_yn.widget = HiddenInput() if camp not in ['ws', 'kids']: self.pname.widget = HiddenInput() else: self.userid.label = '아이디' if camp != 'ws': self.stafftype.widget = HiddenInput() else: self.job.label = '교회 직분' self.job.choices = [(i, i) for i in form_config.CHURCH_JOBS] self.stafftype.choices = form_config.STAFF_TYPES[camp] if camp not in ['cbtj', 'cmc', 'ws']: self.job.widget = HiddenInput() if camp not in ['kids', 'youth']: self.sch1.widget = HiddenInput() self.sch2.widget = HiddenInput() else: self.sch2.choices = form_config.SCH2_CHOICES[camp] if camp == 'kids': self.bus_yn.widget = HiddenInput() self.language.widget = HiddenInput() self.fullcamp_yn.widget = HiddenInput() self.date_of_arrival.widget = HiddenInput() self.date_of_leave.widget = HiddenInput() if camp == 'youth' or camp == 'cbtj' or camp == 'cmc': self.route.choices = form_config.ROUTES[camp] else: self.route.widget = HiddenInput() else: # camp == 'ga' self.userid.widget = HiddenInput() self.area_idx.widget = HiddenInput() self.pwd.widget = HiddenInput() self.pwd2.widget = HiddenInput() self.birth.widget = HiddenInput() self.stafftype.widget = HiddenInput() self.job.widget = HiddenInput() self.job_name.widget = HiddenInput() self.campus.widget = HiddenInput() self.major.widget = HiddenInput() self.sch1.widget = HiddenInput() self.sch2.widget = HiddenInput() self.bus_yn.widget = HiddenInput() self.newcomer_yn.widget = HiddenInput() self.vision_yn.widget = HiddenInput() self.training.widget = HiddenInput() self.route.label = 'GA를 알게된 경로' self.route.choices = [ ('주변사람들의 추천', "주변사람들의 추천"), ('언론매체 및 홍보물', "언론매체 및 홍보물"), ('인터콥소속 선교사 파송교회', "인터콥소속 선교사 파송교회"), ('인터콥 협력교회', "인터콥 협력교회"), ('목선협', "목선협"), ('목회자 비전스쿨', "목회자 비전스쿨"), ('기타', "기타"), ] self.mit_yn.label = "비전캠프 참석 여부" self.persontype.choices = [('목회자', '목회자'), ('비목회자', '비목회자')] self.language.choices = [('필요 없음', '필요 없음'), ('영어', '영어'), ('중국어', '중국어'), ('그 외 언어', '그 외 언어')]
'''청년대학생 선교캠프 단위 테스트''' import unittest from core.database import DB as db from core.models import Member, Membership, Payment, Camp, Group from missioncamp.app import APP as app CMC_CAMP_IDX = Camp.get_idx('cmc') INDIVIDUAL_SAMPLE_DATA = dict( userid="*****@*****.**", pwd="123", pwd2="123", name="123", area_idx="1", sex="M", birth="1988", hp="010", hp2="1234", hp3="1234", contact="010-1234-1234", church="123", persontype="청년", bus_yn="1", mit_yn="1", fullcamp_yn="1", newcomer_yn="0", vision_yn="1", training=["비전스쿨", "선교캠프"], language="", memo=""