예제 #1
0
 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)
예제 #2
0
def signup(request):
    errors = ""
    if request.method == 'POST':
        form = SignupForm(request.POST)
        if form.is_valid():

            # validate existing member
            member_email = form.cleaned_data['member_email']
            member_fname = form.cleaned_data['member_fname']
            member_lname = form.cleaned_data['member_lname']
            plan = form.cleaned_data['plan']

            memberValidate = Member.objects.filter(email=member_email)

            if memberValidate:
                errors = "Email already registered."
            else:
                member = Member(
                    email=member_email,
                    first_name=member_fname,
                    last_name=member_lname,
                    plan=plan,
                )
                member.save()

                return render(request, 'signup.html', {'message': 'Welcome!'})
    else:
        form = SignupForm()

    return render(request, 'signup.html', {'form': form, 'errors': errors})
예제 #3
0
 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)
예제 #4
0
    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)
예제 #5
0
파일: admin.py 프로젝트: ArminMaz/locker
 def sign_up_as_member(self, request, queryset):
     for obj in queryset:
         approved = obj.approved
         print(approved)
         if not approved:
             uid = obj.uid
             print(uid)
             try:
                 member = Member.objects.get(uid=uid)
             except:
                 member = Member(uid=uid)
                 member.save()
예제 #6
0
    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)
예제 #7
0
def run():
    data = pd.read_csv('memberdeets.csv')
    columns = [i for i in data][0:]
    print(columns)
    for i in range(len(data) - 1):
        name = data[columns[0]][i]
        position, deptName = data[columns[1]][i], data[columns[2]][i]
        gifurl = data[columns[4]][i]
        if (position in ['Head', 'Chairperson']):
            m = Member(name=name,
                       position=position,
                       deptName=deptName,
                       posnum=1,
                       gifurl=gifurl)
            m.save()
        else:
            m = Member(name=name,
                       position=position,
                       deptName=deptName,
                       posnum=2,
                       gifurl=gifurl)
            m.save()
예제 #8
0
    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))
예제 #9
0
    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))
예제 #10
0
def run():
    data = pd.read_csv('memberdeets.csv')
    columns = [i for i in data][1:]

    for i in range(80):
        name = data[columns[0]][i] + ' ' + data[columns[1]][i]
        position, deptName, desc = data[columns[2]][i], data[
            columns[3]][i], data[columns[4]][i]
        if position in ["Chairperson", "Head"]:
            m = Member(name=name,
                       position=position,
                       deptName=deptName,
                       posnum=1,
                       desc=desc)
        else:
            m = Member(name=name,
                       position=position,
                       deptName=deptName,
                       posnum=2,
                       desc=desc)
        m.save()
예제 #11
0
 def check_userid():
     '''아이디 중복체크'''
     campidx = Camp.get_idx(campcode)
     userid = request.form.get('userid')
     return "%d" % Member.check_userid(campidx, userid)
예제 #12
0
    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
예제 #13
0
    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
예제 #14
0
 def check_userid():
     '''아이디 중복체크'''
     campidx = Camp.get_idx(campcode)
     userid = request.form.get('userid')
     return "%d" % Member.check_userid(campidx, userid)