Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/A-to-P/atop into feat/#40-…
Browse files Browse the repository at this point in the history
…detailedRequest
  • Loading branch information
Chaewon14 committed Jul 3, 2023
2 parents d084551 + ff6921f commit 43de57b
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 136 deletions.
17 changes: 17 additions & 0 deletions account/migrations/0005_remove_tag_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.2 on 2023-07-03 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('account', '0004_tag_value'),
]

operations = [
migrations.RemoveField(
model_name='tag',
name='value',
),
]
3 changes: 1 addition & 2 deletions account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ def __lt__(self, other):

class Tag(models.Model):
name = models.CharField(max_length=20)
value = models.CharField(max_length=20, default="")
# 요식업분야/컨설팅분야 구분
job = models.CharField(choices=JOB_CHOICES, max_length=10)

class Meta:
db_table = 'tag'
db_table = 'tag'

def __str__(self):
return f"{self.name}"
Expand Down
36 changes: 19 additions & 17 deletions account/templates/signupForm.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,33 @@
<div class="wrapper">
<div class="signup_container">
<!-- 회원가입 폼 제목 -->
<h2 class="signup_title">{% block FormTitle %} {%endblock FormTitle %}</h2>
<h1 class="signup_title">{% block FormTitle %} signupForm {%endblock FormTitle %}</h1>

<form id="signup_form" >
<!-- {% csrf_token %} -->
<div class="mb-3">
<label for="user_name" class="form-label">이름</label>
<input type="text" class="form-control" id="user_name" name="name" placeholder="이름을 입력하세요">
{% if error %}
{{error}}
{% endif %}

<form id="signup_form" method="POST" actions="{% url 'signup_restaurant' %}">
{% csrf_token %}
<div class="form_field">
<label for="user_id"> 이름 </label><br>
<input type="text" class="signup_input" placeholder="아이디를 입력해주세요." id="user_id" name="username"/>
</div>

<div class="mb-3">
<label for="user_id" class="form-label">아이디</label>
<input type="text" class="form-control" id="user_id" name="id" placeholder="아이디를 입력하세요">
<div class="form_field">
<label for="email"> email </label><br>
<input type="text" class="signup_input" placeholder="이메일을 입력해주세요." id="email" name="email"/>
</div>
<div class="mb-3 form_field">
<label for="user_id" class="form-label">비밀번호</label>
<input type="password" class="form-control" name="pw" id="pw" placeholder="비밀번호를 입력하세요">
<input type="password" class="form-control" name="pw_check" id="pw_check" placeholder="비밀번호를 재입력하세요">
<div class="form_field">
<label for="password"> 비밀번호 </label><br>
<input type="text" class="signup_input" placeholder="비밀번호를 입력해주세요." id="password" name="password"/>
<br>
<input type="text" class="signup_input" placeholder="비밀번호 재입력" id="password_check" name="password_check"/>
</div>

<!-- select 폼 -->
{% block selectForm %}

{% endblock selectForm %}
<button type="submit" class="btn btn-primary signup_btn">가입하기</button>

<p><button id="signup_btn">가입하기</button></p>
</form>
</div>
</div>
Expand Down
59 changes: 17 additions & 42 deletions account/templates/signup_consultant.html
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
{% extends 'signupForm.html' %}
{% extends 'signupForm.html' %}

{% block title %}컨설턴트 회원가입 페이지 {%endblock title %}
{% block FormTitle %} 컨설턴트 회원가입 {% endblock FormTitle %}
{% block title %}컨설턴트 회원가입 페이지
{%endblock title %}
{% block FormTitle %}
컨설턴트 회원가입
{% endblock FormTitle %}

{% block selectForm %}
<select class=" form-select request_field" aria-label="Default select example">
<option value="marketing" selected>마케팅</option>
<option value="control_cost">원가 관리</option>
<option value="account_book">회계 장부</option>
<option value="labor">노무</option>
<option value="tax">절세</option>
<option value="sns">SNS</option>
<option value="branding">창업브랜딩</option>
<option value="logo_design">로고 디자인</option>
<option value="interior">인테리어</option>
</select>
<div class="request_field">
<label for="request_field">컨설팅 분야</label><br>
<select name="request_field" id="request_field" required>
<option value="marketing">마케팅</option>
<option value="control_cost">원가 관리</option>
<option value="account_book">회계 장부</option>
<option value="labor">노무</option>
<option value="tax">절세</option>
<option value="sns">SNS</option>
<option value="branding">창업브랜딩</option>
<option value="logo_design">로고 디자인</option>
<option value="interior">인테리어</option>
</select>
{% csrf_token %}
<div class="request_field">
<label for="request_field">컨설팅 분야</label><br>

<div class="authenticate" >
<label for="authenticate" >학교 인증</label><br>
<div class="signup_input" >
<div>
<span style="font-size:small;">학생증이나 재학증명서 이미지 파일을 올려주세요.</span>
<input type="file" style="margin-top: 0.3rem;" id="" name="authenticate"/>
</div>
<div style="margin: auto;">
<input type="button" style="float:right;border:none; border-radius:1rem;" value="인증하기"/>
</div>

</div>

</div>
<select name="request_field" id="request_field" required="required">
{% for tag in tags %}
<option value="{{tag.id}}">{{ tag.name }}</option>
{% endfor %}
</select>

<!-- <div class="authenticate" > <label for="authenticate" >학교 인증</label><br> <input type="email" class="signup_input" placeholder="학교 웹메일을 입력해주세요." id="" name="authenticate"/> <button style="float:right;">인증하기</button><br> </div> -->

</div>
</div>
{% endblock selectForm %}
44 changes: 16 additions & 28 deletions account/templates/signup_restaurant.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
{% extends 'signupForm.html' %}
{% extends 'signupForm.html' %}

{% block title %}요식업자 회원가입 페이지 {%endblock title %}
{% block FormTitle %} 요식업자 회원가입 {% endblock FormTitle %}
{% block title %}요식업자 회원가입 페이지
{%endblock title %}
{% block FormTitle %}
요식업자 회원가입
{% endblock FormTitle %}

{% block selectForm %}
<div class="restaurant_field">
<label for="restaurant_field">요식업 분야</label><br>
<select name="restaurant_field" id="restaurant_field" required>
<option value="korean_food">한식</option>
<option value="western_food">양식</option>
<option value="chinese_food">중식</option>
<option value="japanese_food">일식</option>
<option value="asian_food">아시안</option>
<option value="cafe_dessert">카페・디저트</option>
</select>
</div>
<div class="request_field">
<label for="request_field">컨설팅 희망 분야</label><br>
<select name="request_field" id="request_field" required>
<option value="marketing">마케팅</option>
<option value="control_cost">원가 관리</option>
<option value="account_book">회계 장부</option>
<option value="labor">노무</option>
<option value="tax">절세</option>
<option value="sns">SNS</option>
<option value="branding">창업브랜딩</option>
<option value="logo_design">로고 디자인</option>
<option value="interior">인테리어</option>
</select>
</div>
{% csrf_token %}
<div class="restaurant_field">
<label for="restaurant_field">요식업 분야</label><br>

<select name="restaurant_field" id="restaurant_field" required="required">
{% for tag in tags %}
<option value="{{tag.id}}">{{ tag.name }}</option>
{% endfor %}
</select>
</div>
{% endblock selectForm %}
3 changes: 1 addition & 2 deletions account/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.test import TestCase



# Create your tests here.
72 changes: 36 additions & 36 deletions account/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.contrib.auth import authenticate,login as auth_login, logout as auth_logout
from django.shortcuts import render, redirect
from .models import User
from django.contrib import auth
from .models import RestaurantProfile, ConsultantProfile
from .models import User, Tag, ConsultantProfile, RestaurantProfile
from django.contrib.auth.hashers import make_password

# Create your views here.

Expand Down Expand Up @@ -33,63 +32,64 @@ def signup(request):
return render(request, 'signup.html')

# 기본 회원가입 폼
def signupFrom(request):
def signupForm(request):
return render(request, 'signupForm.html')

# 요식업자 회원가입
# 요식업자
def signup_restaurant(request):
tags = list(Tag.objects.filter(job="restaurant").values())
if request.method =="GET":
return render(request, 'signup_restaurant.html', {'tags':tags})

if request.method == "POST":
tag_id = request.POST['restaurant_field']
username = request.POST['username']
password = request.POST['password']
password_check = request.POST['password_check']
email = request.POST['email']
restaurant_field = request.POST['restaurant_field']


if not username or not password:
error_username = '아이디와 비밀번호를 모두 입력해주세요.'
return render(request, 'account/signup_restaurant.html', {'error_username': error_username})
return render(request, 'signup_restaurant.html', {'error': error_username, 'tags':tags})
if User.objects.filter(username=username).exists():
error_username = '이미 사용 중인 아이디입니다.'
return render(request, 'account/signup_restaurant.html', {'error_username': error_username})
error_username = '이미 사용중인 아이디입니다.'
return render(request, 'signup_restaurant.html', {'error': error_username, 'tags':tags})
if password != password_check:
error_password = '비밀번호와 비밀번호 확인이 일치하지 않습니다.'
return render(request, 'account/signup_restaurant.html', {'error_password': error_password})

user = User.objects.create_user(username=username, password=password, email=email)
user.save()

restaurant_profile = RestaurantProfile(user=user, restaurant_field=restaurant_field)
restaurant_profile.save()

return redirect('home.html')

return render(request, 'signup_restaurant.html')
return render(request, 'signup_restaurant.html', {'error': error_password, 'tags':tags})
else:
user = User.objects.create(username=username,password=make_password(password),email=email,job='restaurant')
user.tag.add(tag_id)
auth_login(request,user)
return redirect('home')


# 컨설턴트 회원가입
#컨설턴트 회원가입폼
def signup_consultant(request):
tags = list(Tag.objects.filter(job="consultant").values())
if request.method =="GET":
return render(request, 'signup_consultant.html', {'tags':tags})

if request.method == "POST":
tag_id = request.POST['request_field']
username = request.POST['username']
password = request.POST['password']
password_check = request.POST['password_check']
email = request.POST['email']
request_field = request.POST['request_field']

if not username or not password:
error_username = '아이디와 비밀번호를 모두 입력해주세요.'
return render(request, 'account/signup_consultant.html', {'error_username': error_username})
return render(request, 'signup_consultant.html', {'error': error_username})
if User.objects.filter(username=username).exists():
error_username = '이미 사용 중인 아이디입니다.'
return render(request, 'account/signup_consultant.html', {'error_username': error_username})
error_username = '이미 사용중인 아이디입니다.'
return render(request, 'signup_consultant.html', {'error': error_username})
if password != password_check:
error_password = '비밀번호와 비밀번호 확인이 일치하지 않습니다.'
return render(request, 'account/signup_consultant.html', {'error_password': error_password})

user = User.objects.create_user(username=username, password=password, email=email)
user.save()

consultant_profile = ConsultantProfile(user=user, request_field=request_field)
consultant_profile.save()

return redirect('home.html')

return render(request, 'signup_consultant.html')
return render(request, 'signup_consultant.html', {'error': error_password})
else:
user = User(username=username, password=make_password(password),email=email,job='consultant')
user.save()
user.tag.add(tag_id)
auth_login(request,user)
return redirect('home')
10 changes: 10 additions & 0 deletions matching/static/css/applyRequest.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.request_wrapper{
margin: 0 auto;
padding: 1rem;
width: 30rem;
height: 33rem;
}

.request_container {
background-color: white;
}
28 changes: 19 additions & 9 deletions matching/templates/applyRequest.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
{% extends 'profile_template.html' %}
{% extends 'base.html' %}
{% load static %}
{% block static %}
<link rel="stylesheet" href="{% static 'css/profile.css' %}" >
<!-- <link rel="stylesheet" href="{% static 'css/profile.css' %}" > -->
<link rel="stylesheet" href="{% static 'css/applyRequest.css' %}" >
{% endblock %}

{% block title %}applyRequest{% endblock %}

{% block content %}
<div class="request_wrapper">
<div class="request_text">컨설팅 의뢰 글 내용</div>
<div class="request_container">
<div class="reqeust_title">의뢰글 제목</div>
<div class="restaurant_info_wrapper">
<div class="request_text">요식업자 정보(프로필 보러가기)</div>
</div>
<div class="consultant_info_wrapper">
<div class="request_text">컨설팅 정보</div>
<div class="request_category">컨설팅 분야 마케팅</div>
<div class="request_money">컨설팅비 xxx,xxx원</div>
</div>
<div class="request_text_content">의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용의뢰글내용</div>
</div>
</div>

{% block profile_title %}
Profile
{% endblock %}

{% block maincontent %}
applyRequest 내용
{% endblock maincontent %}
{% endblock content %}

0 comments on commit 43de57b

Please sign in to comment.