-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
347 lines (322 loc) · 31.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<!DOCTYPE html>
<html lang="en">
<head>
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="http://www.emadmokhtar.com/theme/stylesheet/style.min.css">
<link rel="stylesheet" type="text/css" href="http://www.emadmokhtar.com/theme/stylesheet/pygments.min.css">
<link rel="stylesheet" type="text/css" href="http://www.emadmokhtar.com/theme/stylesheet/font-awesome.min.css">
<link href="http://www.emadmokhtar.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Emad Mokhtar's Framework Atom">
<link href="http://www.emadmokhtar.com/feeds/all.rss.xml" type="application/rss+xml" rel="alternate" title="Emad Mokhtar's Framework RSS">
<link rel="shortcut icon" href="http://www.emadmokhtar.com/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="http://www.emadmokhtar.com/images/favicon.ico" type="image/x-icon">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="" />
<meta name="author" content="Emad Mokhtar" />
<meta name="description" content="My thoughts and experince on software development and life." />
<meta property="og:site_name" content="Emad Mokhtar's Framework"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="Emad Mokhtar's Framework"/>
<meta property="og:description" content="My thoughts and experince on software development and life."/>
<meta property="og:locale" content="en_US"/>
<meta property="og:url" content="http://www.emadmokhtar.com"/>
<meta property="og:image" content="http://www.emadmokhtar.com/images/profile.jpg">
<title>Emad Mokhtar's Framework</title>
</head>
<body>
<aside>
<div>
<a href="http://www.emadmokhtar.com">
<img src="http://www.emadmokhtar.com/images/profile.jpg" alt="" title="">
</a>
<h1><a href="http://www.emadmokhtar.com"></a></h1>
<p>Geek developer who's in search of code perfection.</p>
<nav>
<ul class="list">
<li><a href="http://www.emadmokhtar.com">Blog</a></li>
<li><a href="http://www.emadmokhtar.com/pages/podcasts.html#podcasts">Podcasts</a></li>
<li><a href="http://www.emadmokhtar.com/pages/projects.html#projects">Projects</a></li>
<li><a href="https://emadmokhtar.github.io/resume" target="_blank">Resume</a></li>
</ul>
</nav>
<ul class="social">
<li><a class="sc-envelope-o" href="mailto:emad@emadmokhtar.com" target="_blank"><i class="fa fa-envelope-o"></i></a></li>
<li><a class="sc-github" href="https://www.github.com/EmadMokhtar" target="_blank"><i class="fa fa-github"></i></a></li>
<li><a class="sc-linkedin" href="https://www.linkedin.com/in/emadmokhtar/" target="_blank"><i class="fa fa-linkedin"></i></a></li>
<li><a class="sc-stack-overflow" href="http://stackoverflow.com/users/373051/emad-mokhtar" target="_blank"><i class="fa fa-stack-overflow"></i></a></li>
<li><a class="sc-facebook" href="https://www.facebook.com/emadmokhtarframework/" target="_blank"><i class="fa fa-facebook"></i></a></li>
<li><a class="sc-twitter" href="https://twitter.com/emadmokhtar" target="_blank"><i class="fa fa-twitter"></i></a></li>
</ul>
</div>
</aside>
<main>
<nav>
<a href="http://www.emadmokhtar.com">Home</a>
<a href="https://emadmokhtar.github.io/resume">Resume</a>
<a href="http://www.emadmokhtar.com/feeds/all.atom.xml">Atom</a>
<a href="http://www.emadmokhtar.com/feeds/all.rss.xml">RSS</a>
</nav>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/difference-between-and-is-in-python-and-when-to-use-each-of-them.html#difference-between-and-is-in-python-and-when-to-use-each-of-them">Difference between `==` and `is` in Python, and when to use each of them</a></h2>
<p>
Posted on Sat 26 January 2019 in <a href="http://www.emadmokhtar.com/category/python.html">Python</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/python.html">python</a> • <a href="http://www.emadmokhtar.com/difference-between-and-is-in-python-and-when-to-use-each-of-them.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="Difference" src="http://www.emadmokhtar.com/images/will-francis-1071726-unsplash.jpg"></p>
<p>In Python there are many <a href="https://realpython.com/python-operators-expressions/#comparison-operators">comparison operators</a>; you always use them to check something in your code and let your code take decision according to the comparison</p>
<p>In this article, I want to go deep with two operators <code>==</code> to check equality, and <code>is</code> to check identity.</p>
<a class="btn" href="http://www.emadmokhtar.com/difference-between-and-is-in-python-and-when-to-use-each-of-them.html#difference-between-and-is-in-python-and-when-to-use-each-of-them">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/i-tried-nodejs-and-i-like-it.html#i-tried-nodejs-and-i-like-it">I tried Nodejs and I like it</a></h2>
<p>
Posted on Mon 31 December 2018 in <a href="http://www.emadmokhtar.com/category/python-nodejs.html">python, nodejs</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/python.html">Python</a> • <a href="http://www.emadmokhtar.com/i-tried-nodejs-and-i-like-it.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="The Sign" src="http://www.emadmokhtar.com/images/austin-chan-275638-unsplash.jpg">
Photo by Austin Chan on Unsplash</p>
<p>I had a chance to try Node.js framework last month; I decided to build REST APIs using <a href="https://nodejs.org/en/">Node.js</a> and <a href="https://expressjs.com/">express.js</a>. Regularly I'm using JavaScript in my daily work besides using <a href="https://www.djangoproject.com/">Django</a> to build Web Applications, but many times I need to develop a front-end feature, This when I need to use JavaScript. I'm always using JavaScript to write front-end logic, but I never wrote back-end logic using it. I took the challenge to develop a simple REST APIs using <a href="https://expressjs.com/">express.js</a>.</p>
<a class="btn" href="http://www.emadmokhtar.com/i-tried-nodejs-and-i-like-it.html#i-tried-nodejs-and-i-like-it">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/thank-you-python-community.html#thank-you-python-community">Thank you Python 🐍 community</a></h2>
<p>
Posted on Sun 23 September 2018 in <a href="http://www.emadmokhtar.com/category/python-community.html">python, community</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/python.html">Python</a> • <a href="http://www.emadmokhtar.com/thank-you-python-community.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="thank you" src="http://www.emadmokhtar.com/images/thank-you-community.jpg"></p>
<p>November 2015 <a href="http://emadmokhtar.com/net-developer-comfort-zone.html#net-developer-comfort-zone">I left my comfort zone, and I started my journey with Python</a>, it was not an easy start. I was a Windows/Microsoft guy, I was using Microsoft Visual Studio on a daily basis, and Windows was my primary OS. I switched to macOS and Pycharm; I picked these to make my transition easier than using Linux (Ubuntu) and Vim.</p>
<p>After 2 months of figuring out what are virtualenv, pip, python version, and environment variable. I started another milestone of how to write a pythonic code while that I went to <a href="http://emadmokhtar.com/djangocon-europe-2016-me-and-django-sprints.html#djangocon-europe-2016-me-and-django-sprints">DjangoCon</a>, and I saw how awesome this community is. WOW 🤗, this community is very welcoming for newcomers, and since this day I'm in ❤️ with this community.</p>
<p>Like someone said to me "You are staying because of people not because of the language." Indeed, the community is excellent 👍🏻, and it is what makes this language impressive and always adopting the future.</p>
<p>I want to thank all human beings in this community form leaders to the starters (welcome BTW 😉), thank you for being a part of this community and making this community.</p>
<a class="btn" href="http://www.emadmokhtar.com/thank-you-python-community.html#thank-you-python-community">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/advice-to-junior-developers.html#advice-to-junior-developers">Advice to Junior Developers</a></h2>
<p>
Posted on Mon 09 April 2018 in <a href="http://www.emadmokhtar.com/category/career.html">career</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/career.html">career</a>, <a href="http://www.emadmokhtar.com/tag/developer.html">developer</a>, <a href="http://www.emadmokhtar.com/tag/programmer.html">programmer</a> • <a href="http://www.emadmokhtar.com/advice-to-junior-developers.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="journey" src="http://www.emadmokhtar.com/images/oziel-gomez-555955-unsplash.jpg"></p>
<p>One day I answered <a href="https://www.quora.com/What-is-the-best-advice-you-can-give-to-a-junior-programmer/answer/Emad-Mokhtar">What is the best advice you can give to a junior programmer?</a> question on Quora.com. I was shocked that my answer got many upvotes, so I thought to share my answer to this question on my blog.</p>
<p>First, let me acknowledge you that my answers are just my experience, what I missed during my career as software developer, and I wished someone told me this advice.</p>
<ol>
<li>
<p><strong>Be humble be foolish be patient, you have a long journey of learning, so keep learning.</strong> Technologies are changing so fast, so fast that you can't master everything, but you need to read about everything in software development, read blogs, news, etc. Invest your learning time in what you'll be master in.</p>
</li>
<li>
<p><strong>Don’t be afraid to fail.</strong> Making mistakes is a part of the learning, so please don’t be afraid to make mistakes, but learn from them. Even great software developers got fired, made mistakes, and they feel down, but what makes them great that they get up and learn from mistakes.</p>
</li>
<li>
<p><strong><a href="https://blog.codinghorror.com/the-ten-commandments-of-egoless-programming/">Read about The Ten Commandments of Egoless Programming </a></strong> You will need these commandments during your journey, They helped me in <a href="http://www.emadmokhtar.com/being-a-team-member.html">my first job with a …</a></p></li></ol>
<a class="btn" href="http://www.emadmokhtar.com/advice-to-junior-developers.html#advice-to-junior-developers">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/lets-build-it.html#lets-build-it">Let's build it</a></h2>
<p>
Posted on Sun 04 March 2018 in <a href="http://www.emadmokhtar.com/category/project.html">project</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/side-project.html">side-project</a>, <a href="http://www.emadmokhtar.com/tag/django.html">django</a>, <a href="http://www.emadmokhtar.com/tag/python.html">python</a> • <a href="http://www.emadmokhtar.com/lets-build-it.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="idea" src="http://www.emadmokhtar.com/images/james-pond-185593-unsplash.jpg"></p>
<p><a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;" href="https://unsplash.com/@shotbyjamespond?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target="_blank" rel="noopener noreferrer" title="Download free do whatever you want high-resolution photos from James Pond"><span style="display:inline-block;padding:2px 3px;"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white;" viewBox="0 0 32 32"><title>unsplash-logo</title><path d="M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z"></path></svg></span><span style="display:inline-block;padding:2px 3px;">James Pond</span></a></p>
<h1>Discovery</h1>
<p>After many years of developing web applications, I found my passion is building Web APIs. so why I like it, I like it because I think it's giving your application a power to integrate with other apps (desktop, mobile apps, etc.), other devices (Amazon Dot, Google Home, etc.), sensors (RaspberryPi, Arduino, etc.), and bots (Slack, Telegram, Facebook Messanger, etc.).
Can you feel the power that Web API that can add to your apps?</p>
<h1>Let's build something</h1>
<p>After I found my passion and start to search for a project to ably what I like and keep developing it. I found that there is no Web API for <a href="https://en.wikipedia.org/wiki/Tafsir">Quran Tafseer/Translation</a>. What can Quran Tafseer API do for developers? If you want to develop an application for Quran and you want to provide a Tafseer/Translation to the application users, you need to gather the information from more than one source. I found most of the existing applications done it and after that work, app developers will keep this information available to their app only, so I thought of doing this work for the community and provide Tafseer/Translation for free as Web API.</p>
<h1>Stages</h1>
<h2>Stage I</h2>
<p>I …</p>
<a class="btn" href="http://www.emadmokhtar.com/lets-build-it.html#lets-build-it">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/being-a-team-member.html#being-a-team-member">Being a Team member</a></h2>
<p>
Posted on Sat 10 February 2018 in <a href="http://www.emadmokhtar.com/category/career.html">career</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/career.html">career</a>, <a href="http://www.emadmokhtar.com/tag/work.html">work</a>, <a href="http://www.emadmokhtar.com/tag/netherlands.html">netherlands</a> • <a href="http://www.emadmokhtar.com/being-a-team-member.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="Team" src="http://www.emadmokhtar.com/images/karen-maes-310484.jpg"></p>
<p><a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;" href="https://unsplash.com/@karen1974?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target="_blank" rel="noopener noreferrer" title="Download free do whatever you want high-resolution photos from Karen Maes"><span style="display:inline-block;padding:2px 3px;"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white;" viewBox="0 0 32 32"><title>unsplash-logo</title><path d="M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z"></path></svg></span><span style="display:inline-block;padding:2px 3px;">Karen Maes</span></a></p>
<h2>The Start</h2>
<p>In September 2017 I left my job and my life in <a href="https://en.wikipedia.org/wiki/Kuwait">Kuwait</a> and traveled to the <a href="https://en.wikipedia.org/wiki/Netherlands">Netherlands</a> to join <a href="https://veneficus.nl/en/">Veneficus</a> as Software developer, one of the reasons I moved to the Netherlands is to work in a team and I started to feel being a <a href="http://www.emadmokhtar.com/solo-developer.html">solo developer</a> is bad for my career.</p>
<p>I joined a team of 7 developers mixed between full-time and part-time, and start to fell there are some missing skills I need to develop, and yes I was correct I worked alone for almost 7 years. What is it mean working alone? it means no need for communication, no need for development plans, no need for technical debates, no need to manage your time or other team member's time. In the beginning, I feel so bad and stressed with that change, to be honest, I made many mistakes, but with a growth mindset you need to learn from mistakes and grow and fix them, os what I did?</p>
<h2>Community Help!</h2>
<p>First, I asked for community help, I went to <a href="https://www.pythonistacafe.com/">PythonistaCafe</a> forum and posted my situation and the members gave me great answers regarding my situation, and one member point me to something …</p>
<a class="btn" href="http://www.emadmokhtar.com/being-a-team-member.html#being-a-team-member">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/shinny-new-tools.html#shinny-new-tools">Shinny New Tools</a></h2>
<p>
Posted on Mon 10 July 2017 in <a href="http://www.emadmokhtar.com/category/community.html">Community</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/developer.html">developer</a> • <a href="http://www.emadmokhtar.com/shinny-new-tools.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="Old Tools" src="http://www.emadmokhtar.com/images/felix-russell-saw-167176.jpg"></p>
<p><a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;" href="http://unsplash.com/@frsphoto?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target="_blank" rel="noopener noreferrer" title="Download free do whatever you want high-resolution photos from Felix Russell-Saw"><span style="display:inline-block;padding:2px 3px;"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white;" viewBox="0 0 32 32"><title></title><path d="M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z"></path></svg></span><span style="display:inline-block;padding:2px 3px;">Felix Russell-Saw</span></a></p>
<p>One day I realized that Microsoft technologies are not for what I'm looking for. what I'm looking for is working in startup that developing its own product like Instagram, Shopify, or Pinterest. So I've done some research and I found that Microsoft technologies are not made for this purpose, Microsoft technologies made for enterprises, I worked with Microsoft Dynamics AX, Microsoft SharePoint, ASP.NET WebForms, and ASP.NET Web Services you won't find a startup work with these or built their business around these kind of products, so I start to research for another technology to use.</p>
<p>After long time of research and Q&A with my friend <a href="https://github.com/burhan">Burhan</a>, I switched to <a href="https://www.python.org/">Python</a>, I didn't pick <a href="https://nodejs.org/en/">Node.js</a> or <a href="http://rubyonrails.org/">Ruby on Rails</a>, because I don't like to pick a new shinny tool/framework for sake of it's new, I picked Python and Django one of it's web framework. I found during my research many people recommended Node.js because it's the new thing, again I don't like to pick the new shinny tool, this is common between developer community, developer will be proud if someone ask Which language/framework are you using? and the developer answer is the …</p>
<a class="btn" href="http://www.emadmokhtar.com/shinny-new-tools.html#shinny-new-tools">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/create-login-page-for-your-django-app.html#create-login-page-for-your-django-app">Create Login Page for your Django app</a></h2>
<p>
Posted on Tue 09 May 2017 in <a href="http://www.emadmokhtar.com/category/django.html">Django</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/django.html">django</a>, <a href="http://www.emadmokhtar.com/tag/python.html">python</a>, <a href="http://www.emadmokhtar.com/tag/forms.html">forms</a> • <a href="http://www.emadmokhtar.com/create-login-page-for-your-django-app.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="Create Login Page for your Django app" src="http://www.emadmokhtar.com/images/Create-Login-Page-for-your-Django-app.png"></p>
<h1>Why Another Post about this?</h1>
<p>I found each time I start new Django project, I need to create Login HTML page, and with that I need to write Django View and Form. Each time I tried to Google how to do it, I found many posts about how to do it from scratch, yep as you read, posts telling you how to build a Django View and Form for login page. And there are already built-in Django login <a href="https://docs.djangoproject.com/en/1.11/topics/auth/default/#django.contrib.auth.views.login">View</a> and <a href="https://docs.djangoproject.com/en/1.11/topics/auth/default/#django.contrib.auth.forms.AuthenticationForm">Form</a> (please check links).
So I decided to write my own recipe on how to create Login page in your Django app using the built-in view and form to save time and stop reinvent the wheel.</p>
<h1>How to do it?</h1>
<p>Actually it’s an easy one, because we’ll use already built-in View and Form, so we will build the Template for it, that it. We have a Form and View ready, so first thing first, we’ll write a template to show HTML form for login, I'm assuming you have another template called <code>base.html</code> and we’ll just write the <code>container block</code> part only, and we are using <a href="http://getbootstrap.com">Boostrap framework</a> and <a href="https://github.com/django-crispy-forms/django-crispy-forms">crispy_form app</a>.</p>
<p><strong>login.html</strong></p>
<div class="highlight"><pre><span></span>{% extends "base.html …</pre></div>
<a class="btn" href="http://www.emadmokhtar.com/create-login-page-for-your-django-app.html#create-login-page-for-your-django-app">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/custom-client-side-validation-for-parsley-in-django.html#custom-client-side-validation-for-parsley-in-django">Custom Client Side Validation for Parsley in Django</a></h2>
<p>
Posted on Sun 16 April 2017 in <a href="http://www.emadmokhtar.com/category/django.html">Django</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/django.html">django</a>, <a href="http://www.emadmokhtar.com/tag/python.html">python</a>, <a href="http://www.emadmokhtar.com/tag/parsley.html">parsley</a>, <a href="http://www.emadmokhtar.com/tag/validation.html">validation</a> • <a href="http://www.emadmokhtar.com/custom-client-side-validation-for-parsley-in-django.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="Custom Validation for Parsley in Django" src="http://www.emadmokhtar.com/images/Custom-Validation-for-Parsley-in-Django.jpeg"></p>
<p>I wrote a post on how to add <a href="http://www.emadmokhtar.com/client-side-validation-for-django-forms.html">client side validation for Django Forms</a>. In this post I’ll show you how to add custom client validation to Django Forms. I mean by custom validation is a validation that isn't available in <a href="https://github.com/agiliq/Django-parsley">django-parsley</a>, like username availability, password strength, email duplication, etc.. let’s see how to add custom client side validation to Django Form.</p>
<h1>Parsley remote validation</h1>
<p><a href="http://parsleyjs.org/doc/index.html">Parsley library</a> has <a href="http://parsleyjs.org/doc/index.html#remote">remote validation</a>, it's calling AJAX service (Django view) and check if AJAX call returns <a href="http://www.restapitutorial.com/httpstatuscodes.html">2xx HTTP status codes</a> then it's valid input else it's invalid input and shows error message. Thankfully you can use remote validation in Django Form using django-parsley via <code>parsley-extras</code> attribute.</p>
<p>Example:</p>
<div class="highlight"><pre><span></span><span class="nd">@parsleyfy</span>
<span class="k">class</span> <span class="nc">UserRegistrationForm</span><span class="p">(</span><span class="n">forms</span><span class="o">.</span><span class="n">ModelForm</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span>
<span class="o">...</span>
<span class="n">parsley_extras</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'password'</span><span class="p">:</span> <span class="p">{</span>
<span class="s1">'remote'</span><span class="p">:</span> <span class="n">reverse_lazy</span><span class="p">(</span><span class="s1">'validate-password-parsley'</span><span class="p">),</span>
<span class="s1">'remote-message'</span><span class="p">:</span> <span class="s2">"Password is invalid"</span>
<span class="p">},</span>
<span class="s1">'username'</span><span class="p">:</span> <span class="p">{</span>
<span class="s1">'remote'</span><span class="p">:</span> <span class="n">reverse_lazy</span><span class="p">(</span><span class="s1">'validate_username_uniqueness'</span><span class="p">),</span>
<span class="s1">'remote-message'</span><span class="p">:</span> <span class="s2">"User with this username is already exists."</span>
<span class="p">},</span>
<span class="s1">'email'</span><span class="p">:</span> <span class="p">{</span>
<span class="s1">'remote'</span><span class="p">:</span> <span class="n">reverse_lazy</span><span class="p">(</span><span class="s1">'validate_email_uniqueness'</span><span class="p">),</span>
<span class="s1">'remote-message'</span><span class="p">:</span> <span class="s2">"User with this email is already exists."</span>
<span class="p">},</span>
<span class="p">}</span>
</pre></div>
<p>In the code above we are adding client custom validation as remote to <code>password</code>, <code>username</code>, and <code>email</code> fields, Did you notice that <code>remote</code> key is holding a URL to Django View? let’s create a complete sample to get our head around it.</p>
<h1>Django Password …</h1>
<a class="btn" href="http://www.emadmokhtar.com/custom-client-side-validation-for-parsley-in-django.html#custom-client-side-validation-for-parsley-in-django">Continue reading</a>
</div>
<hr />
</article>
<article>
<header>
<h2><a href="http://www.emadmokhtar.com/book-review-the-subtle-art-of-not-giving-a-fk.html#book-review-the-subtle-art-of-not-giving-a-fk">Book Review: The Subtle Art of Not Giving a F**k</a></h2>
<p>
Posted on Wed 22 March 2017 in <a href="http://www.emadmokhtar.com/category/review.html">Review</a>
• Tagged with
<a href="http://www.emadmokhtar.com/tag/book.html">book</a>, <a href="http://www.emadmokhtar.com/tag/review.html">review</a> • <a href="http://www.emadmokhtar.com/book-review-the-subtle-art-of-not-giving-a-fk.html#disqus_thread">Leave a comment</a>
</p>
</header>
<div>
<p><img alt="Book cover" src="http://www.emadmokhtar.com/images/the-subtle-art.jpg"></p>
<p>Last month I had small trip to Netherlands, Rotterdam, at night I went to have a dinner with friends at <a href="http://www.euromast.nl/en">EuroMast</a>, it was windy day, we putted our bags in my friend’s car trunk, but unfortunately someone broken inside the car and took 2 bags and one of them was my bag. My travel backpack is stolen and I lost most of my gadgets (MacBook Pro, iPad, Amazon Kindle, Wallet, etc..)</p>
<p>After a night at the police station to report the incident, I went to hotel to get some sleep before flying back to home, next day I woke up, prepared my bags and headed to airport, but on my way to the airport I was thinking what to do during my long flight, I thought let’s read a book, so once I reached the airport I went to bookstore and bought <a href="http://amzn.to/2nmdr0B">The Subtle Art of Not Giving a F**k</a>.</p>
<p>So Emad, Why you are telling us these story? Because while I'm reading this book I found this part</p>
<blockquote>
<p>We don't always control what happens to us. But we always control how we interpret what happens to us, as well as how er respond.</p>
</blockquote>
<p>which is what …</p>
<a class="btn" href="http://www.emadmokhtar.com/book-review-the-subtle-art-of-not-giving-a-fk.html#book-review-the-subtle-art-of-not-giving-a-fk">Continue reading</a>
</div>
</article>
<div class="pagination">
<a class="btn" href="http://www.emadmokhtar.com/index2.html">
<i class="fa fa-angle-left"></i> Older Posts
</a>
</div>
<footer>
<p>© Emad Mokhtar </p>
<p>Built using <a href="http://getpelican.com" target="_blank">Pelican</a> - <a href="https://github.com/alexandrevicenzi/flex" target="_blank">Flex</a> theme by <a href="http://alexandrevicenzi.com" target="_blank">Alexandre Vicenzi</a></p> </footer>
</main>
<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-11401860-2', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Blog",
"name": " Emad Mokhtar's Framework ",
"url" : "http://www.emadmokhtar.com",
"image": "http://www.emadmokhtar.com/images/profile.jpg",
"description": "My thoughts and experince on software development and life."
}
</script><script type="text/javascript">
var disqus_shortname = 'emadmokhtarsframework';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>