Showing
7 changed files
with
186 additions
and
33 deletions
... | @@ -11,6 +11,14 @@ class UserCreationForm(UserCreationForm): | ... | @@ -11,6 +11,14 @@ class UserCreationForm(UserCreationForm): |
11 | help_text=("github 레포지토리를 등록하세요.")) | 11 | help_text=("github 레포지토리를 등록하세요.")) |
12 | 12 | ||
13 | 13 | ||
14 | +class UserEditForm(forms.Form): | ||
15 | + email = EmailField(label=("이메일"), required=True, | ||
16 | + help_text=("이메일을 입력하세요.")) | ||
17 | + | ||
18 | + repository = URLField(label=("레포지토리"), required=True, | ||
19 | + help_text=("github 레포지토리를 입력하세요.")) | ||
20 | + | ||
21 | + | ||
14 | class Meta: | 22 | class Meta: |
15 | model = User | 23 | model = User |
16 | fields = ("username", "email", "repository", "password1", "password2") | 24 | fields = ("username", "email", "repository", "password1", "password2") | ... | ... |
... | @@ -26,6 +26,8 @@ urlpatterns = [ | ... | @@ -26,6 +26,8 @@ urlpatterns = [ |
26 | url(r'^home/', HomeView.as_view(), name='home'), | 26 | url(r'^home/', HomeView.as_view(), name='home'), |
27 | url(r'^myapp/', include('myapp.urls', namespace='myapp')), | 27 | url(r'^myapp/', include('myapp.urls', namespace='myapp')), |
28 | 28 | ||
29 | + url(r'^edit/', EditView.as_view(), name='edit'), | ||
30 | + | ||
29 | url(r'^accounts/', include('django.contrib.auth.urls')), | 31 | url(r'^accounts/', include('django.contrib.auth.urls')), |
30 | url(r'^accounts/register/$', UserCreateView.as_view(), name='register'), | 32 | url(r'^accounts/register/$', UserCreateView.as_view(), name='register'), |
31 | url(r'^accounts/register/done$', UserCreateDoneTV.as_view(), name='register_done'), | 33 | url(r'^accounts/register/done$', UserCreateDoneTV.as_view(), name='register_done'), | ... | ... |
... | @@ -59,6 +59,25 @@ class HomeView(View): | ... | @@ -59,6 +59,25 @@ class HomeView(View): |
59 | # with connection.cursor() as cursor: | 59 | # with connection.cursor() as cursor: |
60 | # cursor.execute(query, param_list) | 60 | # cursor.execute(query, param_list) |
61 | 61 | ||
62 | +class EditView(TemplateView): | ||
63 | + template_name = 'registration/edit.html' | ||
64 | + success_url = reverse_lazy('register_done') | ||
65 | + | ||
66 | + def get(self, request, *args, **kwargs): | ||
67 | + context = {} | ||
68 | + red = 10 | ||
69 | + context['red'] = red | ||
70 | + context['form'] = UserEditForm | ||
71 | + return render(self.request, self.template_name, context) | ||
72 | + | ||
73 | + def post(self, request, *args, **kwargs): | ||
74 | + | ||
75 | + email = self.request.POST['email'] | ||
76 | + repository = self.request.POST['repository'] | ||
77 | + | ||
78 | + print(email, repository) | ||
79 | + return render(self.request, 'index.html') | ||
80 | + | ||
62 | 81 | ||
63 | 82 | ||
64 | class UserCreateView(CreateView): | 83 | class UserCreateView(CreateView): | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -14,6 +14,31 @@ class MypageView(TemplateView): | ... | @@ -14,6 +14,31 @@ class MypageView(TemplateView): |
14 | context = {} | 14 | context = {} |
15 | context['form'] = testform | 15 | context['form'] = testform |
16 | 16 | ||
17 | + query = 'SELECT * FROM vuln.vulnInfo' | ||
18 | + | ||
19 | + param_list = [] | ||
20 | + | ||
21 | + with connection.cursor() as cursor: | ||
22 | + cursor.execute(query, param_list) | ||
23 | + | ||
24 | + columns = [column[0] for column in cursor.description] | ||
25 | + | ||
26 | + object_list = [] | ||
27 | + | ||
28 | + for row in cursor.fetchall(): | ||
29 | + object_list.append(dict(zip(columns, row))) | ||
30 | + | ||
31 | + context = {} | ||
32 | + | ||
33 | + red = 3 | ||
34 | + blue = 4 | ||
35 | + green = 5 | ||
36 | + | ||
37 | + context['red'] = red | ||
38 | + context['blue'] = blue | ||
39 | + context['green'] = green | ||
40 | + context['object_list'] = object_list | ||
41 | + | ||
17 | return render(self.request, self.template_name, context) | 42 | return render(self.request, self.template_name, context) |
18 | 43 | ||
19 | 44 | ... | ... |
... | @@ -37,10 +37,6 @@ | ... | @@ -37,10 +37,6 @@ |
37 | <li class="nav-item mx-0 mx-lg-1"> | 37 | <li class="nav-item mx-0 mx-lg-1"> |
38 | <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#about">Dynamic</a> | 38 | <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#about">Dynamic</a> |
39 | </li> | 39 | </li> |
40 | - <li class="nav-item mx-0 mx-lg-1"> | ||
41 | - <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#contact">Contact</a> | ||
42 | - </li> | ||
43 | - | ||
44 | {% if user.is_active %} | 40 | {% if user.is_active %} |
45 | <!-- <li class="nav-item mx-0 mx-lg-1"> | 41 | <!-- <li class="nav-item mx-0 mx-lg-1"> |
46 | <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="/myapp/mypage">myPage</a> | 42 | <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="/myapp/mypage">myPage</a> |
... | @@ -49,7 +45,7 @@ | ... | @@ -49,7 +45,7 @@ |
49 | <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="{% url 'logout' %}?next=/home">Logout</a> | 45 | <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="{% url 'logout' %}?next=/home">Logout</a> |
50 | </li> | 46 | </li> |
51 | <li class="nav-item mx-0 mx-lg-1"> | 47 | <li class="nav-item mx-0 mx-lg-1"> |
52 | - <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="{% url 'logout' %}?next=/home">Edit Info</a> | 48 | + <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="{% url 'edit' %}">Edit Info</a> |
53 | </li> | 49 | </li> |
54 | {% else %} | 50 | {% else %} |
55 | <li class="nav-item mx-0 mx-lg-1"> | 51 | <li class="nav-item mx-0 mx-lg-1"> |
... | @@ -214,34 +210,7 @@ | ... | @@ -214,34 +210,7 @@ |
214 | <br></p> | 210 | <br></p> |
215 | </div> | 211 | </div> |
216 | <div class="col-md-4 mb-5 mb-lg-0"> | 212 | <div class="col-md-4 mb-5 mb-lg-0"> |
217 | - <h4 class="text-uppercase mb-4">Around the Web</h4> | 213 | + |
218 | - <ul class="list-inline mb-0"> | ||
219 | - <li class="list-inline-item"> | ||
220 | - <a class="btn btn-outline-light btn-social text-center rounded-circle" href="#"> | ||
221 | - <i class="fa fa-fw fa-facebook"></i> | ||
222 | - </a> | ||
223 | - </li> | ||
224 | - <li class="list-inline-item"> | ||
225 | - <a class="btn btn-outline-light btn-social text-center rounded-circle" href="#"> | ||
226 | - <i class="fa fa-fw fa-google-plus"></i> | ||
227 | - </a> | ||
228 | - </li> | ||
229 | - <li class="list-inline-item"> | ||
230 | - <a class="btn btn-outline-light btn-social text-center rounded-circle" href="#"> | ||
231 | - <i class="fa fa-fw fa-twitter"></i> | ||
232 | - </a> | ||
233 | - </li> | ||
234 | - <li class="list-inline-item"> | ||
235 | - <a class="btn btn-outline-light btn-social text-center rounded-circle" href="#"> | ||
236 | - <i class="fa fa-fw fa-linkedin"></i> | ||
237 | - </a> | ||
238 | - </li> | ||
239 | - <li class="list-inline-item"> | ||
240 | - <a class="btn btn-outline-light btn-social text-center rounded-circle" href="#"> | ||
241 | - <i class="fa fa-fw fa-dribbble"></i> | ||
242 | - </a> | ||
243 | - </li> | ||
244 | - </ul> | ||
245 | </div> | 214 | </div> |
246 | <div class="col-md-4"> | 215 | <div class="col-md-4"> |
247 | <h4 class="text-uppercase mb-4">About Us</h4> | 216 | <h4 class="text-uppercase mb-4">About Us</h4> | ... | ... |
VulnNotti/templates/registration/edit.html
0 → 100644
1 | +{% load staticfiles %} | ||
2 | +{% load crispy_forms_tags %} | ||
3 | +<!DOCTYPE html> | ||
4 | +<html lang="en"> | ||
5 | + <head> | ||
6 | + | ||
7 | + <meta charset="utf-8"> | ||
8 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
9 | + <meta name="description" content=""> | ||
10 | + <meta name="author" content=""> | ||
11 | + | ||
12 | + <title>VulnNotti</title> | ||
13 | + | ||
14 | + <!-- Bootstrap core CSS --> | ||
15 | + <link rel="stylesheet" href="{% static 'vendor/freelancer_bootstrap/css/bootstrap.min.css' %}"> | ||
16 | + | ||
17 | + <!-- Custom fonts for this template --> | ||
18 | + <link rel="stylesheet" href="{% static 'vendor/freelancer_font-awesome/css/font-awesome.min.css' %}"> | ||
19 | + | ||
20 | + <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css"> | ||
21 | + <link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css"> | ||
22 | + | ||
23 | + <!-- Plugin CSS --> | ||
24 | + <link rel="stylesheet" href="{% static 'vendor/magnific-popup/magnific-popup.css' %}"> | ||
25 | + <!-- Custom styles for this template --> | ||
26 | + <link rel="stylesheet" href="{% static 'css/freelancer.min.css' %}"> | ||
27 | + | ||
28 | + <style> | ||
29 | + | ||
30 | + .errornote{ | ||
31 | + display: block; | ||
32 | + margin: 5px 0; | ||
33 | + border: 1px solid #c30; | ||
34 | + background: #fcf; | ||
35 | + padding: 5px 25px; | ||
36 | + color: #c30; | ||
37 | + font-size: 12px; | ||
38 | + font-weight: bold; | ||
39 | + } | ||
40 | + | ||
41 | + fieldset{ | ||
42 | + border: 1px solid #ccc; | ||
43 | + } | ||
44 | + | ||
45 | + .aligned label{ | ||
46 | + width: 170px; | ||
47 | + display: block; | ||
48 | + padding: 3px 10px 0 0; | ||
49 | + float: left; | ||
50 | + } | ||
51 | + | ||
52 | + .form-row{ | ||
53 | + padding: 10px; | ||
54 | + font-size: 11px; | ||
55 | + border-bottom: 1px solid #eee; | ||
56 | + } | ||
57 | + | ||
58 | + .submit-row{ | ||
59 | + margin: 5px 0; | ||
60 | + border: 1px solid #ccc; | ||
61 | + text-align: right; | ||
62 | + } | ||
63 | + | ||
64 | + .submit-row input{ | ||
65 | + margin: 10px; | ||
66 | + background: #ffc; | ||
67 | + } | ||
68 | + | ||
69 | + </style> | ||
70 | + </head> | ||
71 | + | ||
72 | + <body id="page-top"> | ||
73 | + | ||
74 | + | ||
75 | + <!-- Header --> | ||
76 | + <header class="masthead bg-primary text-white text-center"> | ||
77 | + <div class="container"> | ||
78 | + <h1>Edit User Repository</h1> | ||
79 | + </div> | ||
80 | + </header> | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + <section> | ||
85 | + | ||
86 | + <form method="post" action="."> {% csrf_token %} | ||
87 | + | ||
88 | + {% if form.errors %} | ||
89 | + <p class="errornote">Wrong! Please correct the error(s) below.</p> | ||
90 | + {% endif %} | ||
91 | + | ||
92 | + <fieldset class="aligned"> | ||
93 | + | ||
94 | + <div> | ||
95 | + {{ form|crispy }} | ||
96 | + </div> | ||
97 | + <input class="btn btn-success" style="background-color:#FF0066; border:#FF0066;"type="submit" value="Edit"/> | ||
98 | + | ||
99 | + </fieldset> | ||
100 | + | ||
101 | + </section> | ||
102 | + | ||
103 | + | ||
104 | + | ||
105 | + <div class="copyright py-4 text-center text-white"> | ||
106 | + <div class="container"> | ||
107 | + <small>Copyright ©www.VulnNotti.com</small> | ||
108 | + </div> | ||
109 | + </div> | ||
110 | + | ||
111 | + <!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) --> | ||
112 | + <div class="scroll-to-top d-lg-none position-fixed "> | ||
113 | + <a class="js-scroll-trigger d-block text-center text-white rounded" href="#page-top"> | ||
114 | + <i class="fa fa-chevron-up"></i> | ||
115 | + </a> | ||
116 | + </div> | ||
117 | + | ||
118 | + <!-- Portfolio Modals --> | ||
119 | + | ||
120 | + <script src="{% static 'vendor/freelancer_jquery/jquery.min.js' %}"></script> | ||
121 | + <script src="{% static 'vendor/freelancer_bootstrap/js/bootstrap.bundle.min.js' %}"></script> | ||
122 | + <script src="{% static 'vendor/jquery-easing/jquery.easing.min.js' %}"></script> | ||
123 | + <script src="{% static 'vendor/magnific-popup/jquery.magnific-popup.min.js' %}"></script> | ||
124 | + <script src="{% static 'js/jqBootstrapValidation.js' %}"></script> | ||
125 | + <script src="{% static 'js/contact_me.js' %}"></script> | ||
126 | + <script src="{% static 'js/freelancer.min.js' %}"></script> | ||
127 | + | ||
128 | + </body> | ||
129 | + | ||
130 | +</html> |
-
Please register or login to post a comment