Add files via upload
Swadhin Biswas committed 2 years ago
7e2a37c
1 parent e798f3f
commit 7e2a37c
12 files changed
+751 -0
Showing 12 changed files+751-0
▼appUser/__init__.py
+0-0
0 | 0 |
▼appUser/admin.py
+3-0
| @@ -0,0 +1,3 @@ | ||
1 | +from django.contrib import admin | |
2 | + | |
3 | +# Register your models here. | |
0 | 4 | |
▼appUser/apps.py
+6-0
| @@ -0,0 +1,6 @@ | ||
1 | +from django.apps import AppConfig | |
2 | + | |
3 | + | |
4 | +class AppuserConfig(AppConfig): | |
5 | + default_auto_field = 'django.db.models.BigAutoField' | |
6 | + name = 'appUser' | |
0 | 7 | |
▼appUser/models.py
+11-0
| @@ -0,0 +1,11 @@ | ||
1 | +from django.db import models | |
2 | +from django.contrib.auth.models import User | |
3 | +# Create your models here. | |
4 | +class UserProfile(models.Model): | |
5 | + user = models.OneToOneField(User, on_delete=models.CASCADE) | |
6 | + profile_pic = models.ImageField(upload_to='profile_pics/', blank=True, null=True) | |
7 | + name = models.CharField(max_length=18) | |
8 | + bio=models.TextField(max_length=90,blank=True) | |
9 | + | |
10 | + | |
11 | + | |
0 | 12 | |
▼appUser/templates/appUser/dashbord.html
+257-0
| @@ -0,0 +1,257 @@ | ||
1 | +<!DOCTYPE html> | |
2 | + | |
3 | +<html lang="en"> | |
4 | +<head> | |
5 | + <meta charset="UTF-8"> | |
6 | + <title>{{user}}| PhotoBite</title> | |
7 | + | |
8 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/> | |
9 | + <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap"> | |
10 | + <style media="screen"> | |
11 | + | |
12 | +*{ | |
13 | + margin: 0; | |
14 | + padding: 0; | |
15 | + box-sizing: border-box; | |
16 | + font-family: 'Poppins', sans-serif; | |
17 | +} | |
18 | +body{ | |
19 | + display: flex; | |
20 | + align-items: center; | |
21 | + justify-content: center; | |
22 | + min-height: 100vh; | |
23 | + background: #ecf0f3; | |
24 | +} | |
25 | +.wrapper, | |
26 | +.wrapper .img-area, | |
27 | +.social-icons a, | |
28 | +.buttons button{ | |
29 | + background: #ecf0f3; | |
30 | + box-shadow: -3px -3px 7px #ffffff, | |
31 | + 3px 3px 5px #ceced1; | |
32 | +} | |
33 | +.wrapper{ | |
34 | + position: relative; | |
35 | + width: 350px; | |
36 | + padding: 30px; | |
37 | + border-radius: 10px; | |
38 | + display: flex; | |
39 | + align-items: center; | |
40 | + justify-content: center; | |
41 | + flex-direction: column; | |
42 | +} | |
43 | +.wrapper .icon{ | |
44 | + font-size: 17px; | |
45 | + color: #31344b; | |
46 | + position: absolute; | |
47 | + cursor: pointer; | |
48 | + opacity: 0.7; | |
49 | + top: 15px; | |
50 | + height: 35px; | |
51 | + width: 35px; | |
52 | + text-align: center; | |
53 | + line-height: 35px; | |
54 | + border-radius: 50%; | |
55 | + font-size: 16px; | |
56 | +} | |
57 | +.wrapper .icon i{ | |
58 | + position: relative; | |
59 | + z-index: 9; | |
60 | +} | |
61 | +.wrapper .icon.arrow{ | |
62 | + left: 15px; | |
63 | +} | |
64 | +.wrapper .icon.dots{ | |
65 | + right: 15px; | |
66 | +} | |
67 | +.wrapper .img-area{ | |
68 | + height: 150px; | |
69 | + width: 150px; | |
70 | + border-radius: 50%; | |
71 | + display: flex; | |
72 | + align-items: center; | |
73 | + justify-content: center; | |
74 | +} | |
75 | +.img-area .inner-area{ | |
76 | + height: calc(100% - 25px); | |
77 | + width: calc(100% - 25px); | |
78 | + border-radius: 50%; | |
79 | +} | |
80 | +.inner-area img{ | |
81 | + height: 100%; | |
82 | + width: 100%; | |
83 | + border-radius: 50%; | |
84 | + object-fit: cover; | |
85 | +} | |
86 | +.wrapper .name{ | |
87 | + font-size: 23px; | |
88 | + font-weight: 500; | |
89 | + color: #31344b; | |
90 | + margin: 10px 0 5px 0; | |
91 | +} | |
92 | +.wrapper .about{ | |
93 | + color: #44476a; | |
94 | + font-weight: 400; | |
95 | + font-size: 16px; | |
96 | +} | |
97 | +.wrapper .social-icons{ | |
98 | + margin: 15px 0 25px 0; | |
99 | +} | |
100 | +.social-icons a{ | |
101 | + position: relative; | |
102 | + height: 40px; | |
103 | + width: 40px; | |
104 | + margin: 0 5px; | |
105 | + display: inline-flex; | |
106 | + text-decoration: none; | |
107 | + border-radius: 50%; | |
108 | +} | |
109 | +.social-icons a:hover::before, | |
110 | +.wrapper .icon:hover::before, | |
111 | +.buttons button:hover:before{ | |
112 | + content: ""; | |
113 | + position: absolute; | |
114 | + top: 0; | |
115 | + left: 0; | |
116 | + bottom: 0; | |
117 | + right: 0; | |
118 | + border-radius: 50%; | |
119 | + background: #ecf0f3; | |
120 | + box-shadow: inset -3px -3px 7px #ffffff, | |
121 | + inset 3px 3px 5px #ceced1; | |
122 | +} | |
123 | +.buttons button:hover:before{ | |
124 | + z-index: -1; | |
125 | + border-radius: 5px; | |
126 | +} | |
127 | +.social-icons a i{ | |
128 | + position: relative; | |
129 | + z-index: 3; | |
130 | + text-align: center; | |
131 | + width: 100%; | |
132 | + height: 100%; | |
133 | + line-height: 40px; | |
134 | +} | |
135 | +.social-icons a.fb i{ | |
136 | + color: #4267B2; | |
137 | +} | |
138 | +.social-icons a.twitter i{ | |
139 | + color: #1DA1F2; | |
140 | +} | |
141 | +.social-icons a.insta i{ | |
142 | + color: #E1306C; | |
143 | +} | |
144 | +.social-icons a.yt i{ | |
145 | + color: #ff0000; | |
146 | +} | |
147 | +.wrapper .buttons{ | |
148 | + display: flex; | |
149 | + width: 100%; | |
150 | + justify-content: space-between; | |
151 | +} | |
152 | +.buttons button{ | |
153 | + position: relative; | |
154 | + width: 100%; | |
155 | + border: none; | |
156 | + outline: none; | |
157 | + padding: 12px 0; | |
158 | + color: #31344b; | |
159 | + font-size: 17px; | |
160 | + font-weight: 400; | |
161 | + border-radius: 5px; | |
162 | + cursor: pointer; | |
163 | + z-index: 4; | |
164 | +} | |
165 | +.buttons button:first-child{ | |
166 | + margin-right: 10px; | |
167 | +} | |
168 | +.buttons button:last-child{ | |
169 | + margin-left: 10px; | |
170 | +} | |
171 | +.wrapper .social-share{ | |
172 | + display: flex; | |
173 | + width: 100%; | |
174 | + margin-top: 30px; | |
175 | + padding: 0 5px; | |
176 | + justify-content: space-between; | |
177 | +} | |
178 | +.social-share .row{ | |
179 | + color: #31344b; | |
180 | + font-size: 17px; | |
181 | + cursor: pointer; | |
182 | + position: relative; | |
183 | +} | |
184 | +.social-share .row::before{ | |
185 | + position: absolute; | |
186 | + content: ""; | |
187 | + height: 100%; | |
188 | + width: 2px; | |
189 | + background: #e0e6eb; | |
190 | + margin-left: -25px; | |
191 | +} | |
192 | +.row:first-child::before{ | |
193 | + background: none; | |
194 | +} | |
195 | +.social-share .row i.icon-2{ | |
196 | + position: absolute; | |
197 | + left: 0; | |
198 | + top: 50%; | |
199 | + color: #31344b; | |
200 | + transform: translateY(-50%); | |
201 | + opacity: 0; | |
202 | + pointer-events: none; | |
203 | + transition: all 0.3s ease; | |
204 | +} | |
205 | +.row:nth-child(1):hover i.fa-heart, | |
206 | +.row:nth-child(2):hover i.fa-comment{ | |
207 | + opacity: 1; | |
208 | + pointer-events: auto; | |
209 | +} | |
210 | + </style> | |
211 | + | |
212 | +</head> | |
213 | +<body> | |
214 | + <div class="wrapper"> | |
215 | + <div class="img-area"> | |
216 | + <div class="inner-area"> | |
217 | + <img src="https://img.icons8.com/stickers/100/user.png" alt=""> | |
218 | + </div> | |
219 | + </div> | |
220 | + <div class="icon arrow"><i class="fas fa-arrow-left"> | |
221 | + | |
222 | + </i></div> | |
223 | + <div class="icon dots"><i class="fas fa-ellipsis-v"></i></div> | |
224 | + <div class="name">{{request.user.username}}</div> | |
225 | + <div class="about">{{request.user.email}}</div> | |
226 | + <div class="social-icons"> | |
227 | + <a href="#" class="fb"><i class="fab fa-facebook-f"></i></a> | |
228 | + <a href="#" class="twitter"><i class="fab fa-twitter"></i></a> | |
229 | + <a href="#" class="insta"><i class="fab fa-instagram"></i></a> | |
230 | + <a href="#" class="yt"><i class="fab fa-youtube"></i></a> | |
231 | + </div> | |
232 | + <div class="buttons"> | |
233 | + <a href="{% url 'userinfo' %}"> | |
234 | + <button>Profile Edit</button> </a> | |
235 | + <a href="{% url 'home' %}"> | |
236 | + <button>PhotoAlbum</button> </a> | |
237 | + | |
238 | + </div> | |
239 | + <div class="social-share"> | |
240 | + <div class="row"> | |
241 | + <i class="far fa-heart"></i> | |
242 | + <i class="icon-2 fas fa-heart"></i> | |
243 | + <span>20.4k</span> | |
244 | + </div> | |
245 | + <div class="row"> | |
246 | + <i class="far fa-comment"></i> | |
247 | + <i class="icon-2 fas fa-comment"></i> | |
248 | + <span>14.3k</span> | |
249 | + </div> | |
250 | + <div class="row"> | |
251 | + <i class="fas fa-share"></i> | |
252 | + <span>12.8k</span> | |
253 | + </div> | |
254 | + </div> | |
255 | + </div> | |
256 | +</body> | |
257 | +</html> | |
0 | 258 | |
▼appUser/templates/appUser/login.html
+160-0
| @@ -0,0 +1,160 @@ | ||
1 | +<!DOCTYPE html> | |
2 | +<html lang="en"> | |
3 | +<head> | |
4 | + <!-- Design by foolishdeveloper.com --> | |
5 | + <title>Login Page</title> | |
6 | + | |
7 | + <link rel="preconnect" href="https://fonts.gstatic.com"> | |
8 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | |
9 | + <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600&display=swap" rel="stylesheet"> | |
10 | + <!--Stylesheet--> | |
11 | + <style media="screen"> | |
12 | + *, | |
13 | +*:before, | |
14 | +*:after{ | |
15 | + padding: 0; | |
16 | + margin: 0; | |
17 | + box-sizing: border-box; | |
18 | +} | |
19 | +body{ | |
20 | + background-color: #080710; | |
21 | +} | |
22 | +.background{ | |
23 | + width: 430px; | |
24 | + height: 520px; | |
25 | + position: absolute; | |
26 | + transform: translate(-50%,-50%); | |
27 | + left: 50%; | |
28 | + top: 50%; | |
29 | +} | |
30 | +.background .shape{ | |
31 | + height: 200px; | |
32 | + width: 200px; | |
33 | + position: absolute; | |
34 | + border-radius: 50%; | |
35 | +} | |
36 | +.shape:first-child{ | |
37 | + background: linear-gradient( | |
38 | + #1845ad, | |
39 | + #23a2f6 | |
40 | + ); | |
41 | + left: -80px; | |
42 | + top: -80px; | |
43 | +} | |
44 | +.shape:last-child{ | |
45 | + background: linear-gradient( | |
46 | + to right, | |
47 | + #ff512f, | |
48 | + #f09819 | |
49 | + ); | |
50 | + right: -30px; | |
51 | + bottom: -80px; | |
52 | +} | |
53 | +form{ | |
54 | + height: 520px; | |
55 | + width: 400px; | |
56 | + background-color: rgba(255,255,255,0.13); | |
57 | + position: absolute; | |
58 | + transform: translate(-50%,-50%); | |
59 | + top: 50%; | |
60 | + left: 50%; | |
61 | + border-radius: 10px; | |
62 | + backdrop-filter: blur(10px); | |
63 | + border: 2px solid rgba(255,255,255,0.1); | |
64 | + box-shadow: 0 0 40px rgba(8,7,16,0.6); | |
65 | + padding: 50px 35px; | |
66 | +} | |
67 | +form *{ | |
68 | + font-family: 'Poppins',sans-serif; | |
69 | + color: #ffffff; | |
70 | + letter-spacing: 0.5px; | |
71 | + outline: none; | |
72 | + border: none; | |
73 | +} | |
74 | +form h3{ | |
75 | + font-size: 32px; | |
76 | + font-weight: 500; | |
77 | + line-height: 42px; | |
78 | + text-align: center; | |
79 | +} | |
80 | + | |
81 | +label{ | |
82 | + display: block; | |
83 | + margin-top: 30px; | |
84 | + font-size: 16px; | |
85 | + font-weight: 500; | |
86 | +} | |
87 | +input{ | |
88 | + display: block; | |
89 | + height: 50px; | |
90 | + width: 100%; | |
91 | + background-color: rgba(255,255,255,0.07); | |
92 | + border-radius: 3px; | |
93 | + padding: 0 10px; | |
94 | + margin-top: 8px; | |
95 | + font-size: 14px; | |
96 | + font-weight: 300; | |
97 | +} | |
98 | +::placeholder{ | |
99 | + color: #e5e5e5; | |
100 | +} | |
101 | +button{ | |
102 | + margin-top: 50px; | |
103 | + width: 100%; | |
104 | + background-color: #ffffff; | |
105 | + color: #080710; | |
106 | + padding: 15px 0; | |
107 | + font-size: 18px; | |
108 | + font-weight: 600; | |
109 | + border-radius: 5px; | |
110 | + cursor: pointer; | |
111 | +} | |
112 | +.social{ | |
113 | + margin-top: 30px; | |
114 | + display: flex; | |
115 | +} | |
116 | +.social div{ | |
117 | + background: red; | |
118 | + width: 150px; | |
119 | + border-radius: 3px; | |
120 | + padding: 5px 10px 10px 5px; | |
121 | + background-color: rgba(255,255,255,0.27); | |
122 | + color: #eaf0fb; | |
123 | + text-align: center; | |
124 | +} | |
125 | +.social div:hover{ | |
126 | + background-color: rgba(255,255,255,0.47); | |
127 | +} | |
128 | +.social .fb{ | |
129 | + margin-left: 25px; | |
130 | +} | |
131 | +.social i{ | |
132 | + margin-right: 4px; | |
133 | +} | |
134 | + | |
135 | + </style> | |
136 | +</head> | |
137 | +<body> | |
138 | + <div class="background"> | |
139 | + <div class="shape"></div> | |
140 | + <div class="shape"></div> | |
141 | + </div> | |
142 | + <form method="post"> | |
143 | + <h3>Login Here</h3> | |
144 | + {% csrf_token %} | |
145 | + <label for="username">Username</label> | |
146 | + <input type="text" placeholder="Enter Username" id="username" name="username"> | |
147 | + | |
148 | + <label for="password">Password</label> | |
149 | + <input type="password" placeholder="Password" id="password" name="pass"> | |
150 | + | |
151 | + <button type="submit">Log In</button> | |
152 | + <!-- <input type="button" value=""> --> | |
153 | + <!-- <div class="social"> | |
154 | + <div class="go"><i class="fab fa-google"></i> Google</div> | |
155 | + <div class="fb"><i class="fab fa-facebook"></i> Facebook</div> | |
156 | + </div> --> | |
157 | + <a href="{% url 'signup' %}" >Create a account</a> | |
158 | + </form> | |
159 | +</body> | |
160 | +</html> | |
0 | 161 | |
▼appUser/templates/appUser/signup.html
+163-0
| @@ -0,0 +1,163 @@ | ||
1 | +<!DOCTYPE html> | |
2 | +<html lang="en"> | |
3 | +<head> | |
4 | + <!-- Design by foolishdeveloper.com --> | |
5 | + <title>Signup Page</title> | |
6 | + | |
7 | + <link rel="preconnect" href="https://fonts.gstatic.com"> | |
8 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | |
9 | + <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600&display=swap" rel="stylesheet"> | |
10 | + <!--Stylesheet--> | |
11 | + <style media="screen"> | |
12 | + *, | |
13 | +*:before, | |
14 | +*:after{ | |
15 | + padding: 0; | |
16 | + margin: 0; | |
17 | + box-sizing: border-box; | |
18 | +} | |
19 | +body{ | |
20 | + background-color: #080710; | |
21 | +} | |
22 | +.background{ | |
23 | + width: 430px; | |
24 | + height: 520px; | |
25 | + position: absolute; | |
26 | + transform: translate(-50%,-50%); | |
27 | + left: 50%; | |
28 | + top: 50%; | |
29 | +} | |
30 | +.background .shape{ | |
31 | + height: 200px; | |
32 | + width: 200px; | |
33 | + position: absolute; | |
34 | + border-radius: 50%; | |
35 | +} | |
36 | +.shape:first-child{ | |
37 | + background: linear-gradient( | |
38 | + #1845ad, | |
39 | + #23a2f6 | |
40 | + ); | |
41 | + left: -80px; | |
42 | + top: -80px; | |
43 | +} | |
44 | +.shape:last-child{ | |
45 | + background: linear-gradient( | |
46 | + to right, | |
47 | + #ff512f, | |
48 | + #f09819 | |
49 | + ); | |
50 | + right: -30px; | |
51 | + bottom: -80px; | |
52 | +} | |
53 | +form{ | |
54 | + height: 600px; | |
55 | + width: 450px; | |
56 | + background-color: rgba(255,255,255,0.13); | |
57 | + position: absolute; | |
58 | + transform: translate(-50%,-50%); | |
59 | + top: 50%; | |
60 | + left: 50%; | |
61 | + border-radius: 10px; | |
62 | + backdrop-filter: blur(10px); | |
63 | + border: 2px solid rgba(255,255,255,0.1); | |
64 | + box-shadow: 0 0 40px rgba(8,7,16,0.6); | |
65 | + padding: 50px 35px; | |
66 | +} | |
67 | +form *{ | |
68 | + font-family: 'Poppins',sans-serif; | |
69 | + color: #ffffff; | |
70 | + letter-spacing: 0.5px; | |
71 | + outline: none; | |
72 | + border: none; | |
73 | +} | |
74 | +form h3{ | |
75 | + font-size: 32px; | |
76 | + font-weight: 500; | |
77 | + line-height: 42px; | |
78 | + text-align: center; | |
79 | +} | |
80 | + | |
81 | +label{ | |
82 | + display: block; | |
83 | + margin-top: 30px; | |
84 | + font-size: 16px; | |
85 | + font-weight: 500; | |
86 | +} | |
87 | +input{ | |
88 | + display: block; | |
89 | + height: 40px; | |
90 | + width: 100%; | |
91 | + background-color: rgba(255,255,255,0.07); | |
92 | + border-radius: 3px; | |
93 | + padding: 0 10px; | |
94 | + margin-top: 2px; | |
95 | + font-size: 14px; | |
96 | + font-weight: 300; | |
97 | +} | |
98 | +::placeholder{ | |
99 | + color: #e5e5e5; | |
100 | +} | |
101 | +button{ | |
102 | + margin-top: 14px; | |
103 | + width: 100%; | |
104 | + background-color: #ffffff; | |
105 | + color: #080710; | |
106 | + padding: 15px 0; | |
107 | + font-size: 18px; | |
108 | + font-weight: 600; | |
109 | + border-radius: 5px; | |
110 | + cursor: pointer; | |
111 | +} | |
112 | +.social{ | |
113 | + margin-top: 30px; | |
114 | + display: flex; | |
115 | +} | |
116 | +.social div{ | |
117 | + background: red; | |
118 | + width: 150px; | |
119 | + border-radius: 3px; | |
120 | + padding: 5px 10px 10px 5px; | |
121 | + background-color: rgba(255,255,255,0.27); | |
122 | + color: #eaf0fb; | |
123 | + text-align: center; | |
124 | +} | |
125 | +.social div:hover{ | |
126 | + background-color: rgba(255,255,255,0.47); | |
127 | +} | |
128 | +.social .fb{ | |
129 | + margin-left: 25px; | |
130 | +} | |
131 | +.social i{ | |
132 | + margin-right: 4px; | |
133 | +} | |
134 | + | |
135 | + </style> | |
136 | +</head> | |
137 | +<body> | |
138 | + <div class="background"> | |
139 | + <div class="shape"></div> | |
140 | + <div class="shape"></div> | |
141 | + </div> | |
142 | + <form action="" method="post"> | |
143 | + {% csrf_token %} | |
144 | + <h3>Signup Here</h3> | |
145 | + | |
146 | + <label for="username">Username</label> | |
147 | + <input type="text" placeholder="Username" name="username" id="username"> | |
148 | + | |
149 | + <label for="email">Email</label> | |
150 | + <input type="email" placeholder="Email or Phone" name="email" id="email"> | |
151 | + | |
152 | + <label for="password1">Password</label> | |
153 | + <input type="password" placeholder="Password" id="password1" name="password1"> | |
154 | + | |
155 | + | |
156 | + <label for="password2">Confrom Password</label> | |
157 | + <input type="password" placeholder="Confrom Password" id="password2" name="password2"> | |
158 | + <button type="submit">Signup</button> | |
159 | + | |
160 | + <a href="{% url 'signin' %}" >Already have an account? </a> | |
161 | + </form> | |
162 | +</body> | |
163 | +</html> | |
0 | 164 | |
▼appUser/templates/appUser/userinfo.html
+43-0
| @@ -0,0 +1,43 @@ | ||
1 | +<!DOCTYPE html> | |
2 | +<html lang="en"> | |
3 | +<head> | |
4 | + <meta charset="UTF-8"> | |
5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
6 | + <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet"> | |
7 | + <title>User Form</title> | |
8 | +</head> | |
9 | +<body class="bg-gray-100 p-6"> | |
10 | + | |
11 | + <div class="max-w-md mx-auto bg-white rounded p-8 shadow-md"> | |
12 | + <h2 class="text-2xl font-semibold mb-4">User Profile</h2> | |
13 | + | |
14 | + <!-- Form --> | |
15 | + <form action="#" method="POST",enctype="multipart/form-data"> | |
16 | + {% csrf_token %} | |
17 | + | |
18 | + <!-- Name --> | |
19 | + <div class="mb-4"> | |
20 | + <label for="name" class="block text-gray-700 text-sm font-bold mb-2">Name</label> | |
21 | + <input type="text" id="name" name="name" class="w-full p-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500" placeholder="Enter your name" required> | |
22 | + </div> | |
23 | + | |
24 | + <!-- Profile Picture Upload --> | |
25 | + <div class="mb-4"> | |
26 | + <label for="profilePicture" class="block text-gray-700 text-sm font-bold mb-2">Profile Picture</label> | |
27 | + <input type="file" id="profilePicture" name="profilePicture" class="w-full p-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500" accept="image/*"> | |
28 | + </div> | |
29 | + | |
30 | + <!-- Bio --> | |
31 | + <div class="mb-4"> | |
32 | + <label for="bio" class="block text-gray-700 text-sm font-bold mb-2">Bio</label> | |
33 | + <textarea id="bio" name="bio" class="w-full p-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500" placeholder="Write a short bio" rows="4"></textarea> | |
34 | + </div> | |
35 | + | |
36 | + <!-- Submit Button --> | |
37 | + <button type="submit" class="bg-blue-500 text-white p-2 rounded hover:bg-blue-600 focus:outline-none focus:shadow-outline-blue">Submit</button> | |
38 | + | |
39 | + </form> | |
40 | + </div> | |
41 | + | |
42 | +</body> | |
43 | +</html> | |
0 | 44 | |
▼appUser/tests.py
+3-0
| @@ -0,0 +1,3 @@ | ||
1 | +from django.test import TestCase | |
2 | + | |
3 | +# Create your tests here. | |
0 | 4 | |
▼appUser/urls.py
+15-0
| @@ -0,0 +1,15 @@ | ||
1 | +from django.contrib import admin | |
2 | +from django.urls import path | |
3 | +from . import views | |
4 | +from django.conf.urls.static import static | |
5 | +from django.conf import settings | |
6 | +from phos.views import getImage | |
7 | + | |
8 | +urlpatterns = [ | |
9 | + path('signin/',views.LoginPage,name='signin'), | |
10 | + path('signup/',views.SignUp,name='signup'), | |
11 | + path('dashbord/',views.Dashbord,name='dashbord'), | |
12 | + path('logout/',getImage,name='logout'), | |
13 | + path('userinfo/',views.userInfo,name='userinfo'), | |
14 | + | |
15 | +]+ static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) | |
0 | 16 | |
▼appUser/userform.py
+10-0
| @@ -0,0 +1,10 @@ | ||
1 | +from django import forms | |
2 | +from phos.models import ImageUploader | |
3 | +from .models import UserProfile | |
4 | + | |
5 | +class Userdetails(forms.ModelForm): | |
6 | + class Meta: | |
7 | + model=UserProfile | |
8 | + fields=['profile_pic','name','bio'] | |
9 | + labels={'profile_pic':'','name':'','bio':''} | |
10 | + | |
0 | 11 | |
▼appUser/views.py
+80-0
| @@ -0,0 +1,80 @@ | ||
1 | +from django.shortcuts import render,redirect | |
2 | +from django.contrib.auth.models import User | |
3 | +from django.contrib import messages | |
4 | +from django.contrib import auth | |
5 | +from django.http import HttpResponse | |
6 | +from django.contrib.auth.decorators import login_required | |
7 | +from .models import UserProfile | |
8 | + | |
9 | +@login_required(login_url='signin') | |
10 | +def Dashbord(request): | |
11 | + return render(request,'appUser/dashbord.html') | |
12 | + | |
13 | +# Create your views here. | |
14 | +def LoginPage(request): | |
15 | + if request.method=='POST': | |
16 | + username=request.POST.get('username') | |
17 | + password=request.POST.get('pass') | |
18 | + | |
19 | + user=auth.authenticate(username=username,password=password) | |
20 | + | |
21 | + if user is not None: | |
22 | + auth.login(request,user) | |
23 | + return redirect('dashbord') | |
24 | + else: | |
25 | + messages.error(request,'invalid credentials') | |
26 | + | |
27 | + | |
28 | + | |
29 | + | |
30 | + | |
31 | + return render(request,'appUser/login.html') | |
32 | + | |
33 | +def SignUp(request): | |
34 | + if request.method=='POST': | |
35 | + username=request.POST.get('username') | |
36 | + email=request.POST.get('email') | |
37 | + password1=request.POST.get('password1') | |
38 | + password2 =request.POST.get('password2') | |
39 | + | |
40 | + | |
41 | + if password1!=password2: | |
42 | + | |
43 | + messages.error(request,'password do not match') | |
44 | + | |
45 | + else: | |
46 | + appuser=User.objects.create_user(username,email,password1) | |
47 | + appuser.save() | |
48 | + messages.success(request,'User Created Successfully') | |
49 | + | |
50 | + return redirect ('signin') | |
51 | + | |
52 | + | |
53 | + | |
54 | + | |
55 | + return render(request,'appUser/signup.html') | |
56 | + | |
57 | + | |
58 | +def Signout(request): | |
59 | + | |
60 | + return render(request,'appUser/logout.html') | |
61 | + | |
62 | + | |
63 | +#def getUsername(request): | |
64 | + # username=request.user | |
65 | + # return render(request,'appUser/dashbord.html',{'username':username}) | |
66 | + | |
67 | + | |
68 | +@login_required(login_url='signin') | |
69 | +def userInfo(request): | |
70 | + | |
71 | + if request.method=='POST': | |
72 | + name=request.POST.get('name') | |
73 | + bio=request.POST.get('bio') | |
74 | + profile_pic=request.FILES.get('profilePicture') | |
75 | + user=request.user | |
76 | + userprofile=UserProfile(user=user,name=name,bio=bio,profile_pic=profile_pic) | |
77 | + userprofile.save() | |
78 | + | |
79 | + redirect(request,'dashbord') | |
80 | + return render(request,'appUser/userinfo.html') | |
0 | 81 | |