You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/tutorials/django-authentication-system.mdx
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,29 @@
1
1
---
2
-
sidebar_position: 5
3
-
description: Learn how to manage users in Django with ease - tutorial for beginners.
2
+
title : Django Auth System
3
+
sidebar_label : Django Auth
4
4
---
5
5
6
6
# Django Auth System
7
7
8
8
<SubHeading>Learn how to manage users in Django with ease - tutorial for beginners.</SubHeading>
9
9
10
-
Being a "batteries-included" framework, Django comes with a powerful authentication/authorization system that we can use and extend in our projects with ease. For those that start from nothing, feel free to access the resources mentioned below and come back here once the content is understood:
10
+
Being a "batteries-included" framework, Django comes with a powerful authentication/authorization system that we can use and extend in our projects with ease.
11
+
For those that start from nothing, feel free to access the resources mentioned below and come back here once the content is understood:
11
12
12
13
-[How to install Django](django-how-to-install.mdx) - simple, tested steps to install Django
13
14
-[Django for beginners](django-for-beginners.mdx) - a comprehensive tutorial that covers the basics
14
15
15
-
> Topics covered in this tutorial
16
+

17
+
18
+
> **Topics covered in this tutorial**
16
19
17
20
-`User` the table where the information is saved
18
21
- How to create a new user using the Django CLI
19
22
- How to create a `superuser`
20
23
- How to `update the password` - Django CLI
21
24
- Create a user using forms
22
25
23
-
###User Model
26
+
##✅ User Model
24
27
25
28
As mentioned in the official Django documentation, the **User** model represents the core entity used to save and manage authentication. The fields managed by the User model can be found below:
26
29
@@ -59,7 +62,7 @@ $ .\env\Scripts\activate
59
62
$ pip install django
60
63
```
61
64
62
-
###Create Users - Django CLI
65
+
##✅ Create Users - Django CLI
63
66
64
67
The user creation process using the terminal is usually related to the `superuser` that allows us to access the `admin` section. For newcomers, the admin section manages the registered users, groups defined in our project.
65
68
@@ -111,9 +114,7 @@ As we can see, new users can be created with ease using the `create-user` helper
111
114
<QuerySet [<User: admin>, <User: test>]>
112
115
```
113
116
114
-
115
-
116
-
### Create Users via UI
117
+
## ✅ Create Users via UI
117
118
118
119
Using the console to create and manage users might be fun but might be also useful in our projects to allow users to register themselves using a public web page. To do this, we need a simple page where the form is exposed and a backend to handle the information sent to the user.
Django hooks the authenticated in the `request` object and we can check if a request is done by an authenticated user or not by calling a helper. The same check is available in views.
263
264
@@ -290,7 +291,7 @@ def testme(path):
290
291
{% endraw %}
291
292
```
292
293
293
-
###Logout Users
294
+
##✅ Logout Users
294
295
295
296
The `logout` helper is provided by `Django.contrib.auth` middleware package:
296
297
@@ -306,7 +307,9 @@ If the user is authenticated all session information will be deleted. If the use
306
307
307
308
> Thanks for reading! For more topics, feel free to [contact](https://appseed.us/support) Appseed.
308
309
309
-
### Resources
310
+
##✅ Resources
310
311
311
-
- Read more about [Django](https://www.djangoproject.com/) (official docs)
312
-
- Start fast a new project using _development-ready_[Django Starters](https://appseed.us/admin-dashboards/django)
312
+
- 👉 Access [AppSeed](https://appseed.us/) and start your next project
313
+
- 👉 [Deploy Projects on Aws, Azure, and DO](https://www.docs.deploypro.dev/) via **DeployPRO**
314
+
- 👉 Create landing pages with [Simpllo, an open-source site builder](https://www.simpllo.com/)
Copy file name to clipboardExpand all lines: docs/content/tutorials/django-for-beginners.mdx
+25-17Lines changed: 25 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,19 @@
1
1
---
2
-
sidebar_position: 2
3
-
description: A comprehensive introduction to Django for beginners
2
+
title : Django For Beginners
3
+
sidebar_label :Django For Beginners
4
4
---
5
5
6
6
# Django For Beginners
7
7
8
8
<SubHeading>A comprehensive introduction to Django for beginners</SubHeading>
9
9
10
-
This tutorial aims to help beginners getting started with Django, a popular Web Framework written in Python. To get maximum from this content, the audience should be familiar with a terminal and have a minimal set of tools already installed. [Python3](https://www.python.org/), a modern code editor ([VsCode](https://code.visualstudio.com/), [Atom](https://atom.io/)), and [GIT](https://git-scm.com/) versioning command-line tool should be enough to experiment with all the code.
10
+
This tutorial aims to help beginners getting started with Django, a popular Web Framework written in Python.
11
+
To get maximum from this content, the audience should be familiar with a terminal and have a minimal set of tools already installed.
12
+
[Python3](https://www.python.org/), a modern code editor ([VsCode](https://code.visualstudio.com/), [Atom](https://atom.io/)), and [GIT](https://git-scm.com/) versioning command-line tool should be enough to experiment with all the code.
11
13
12
-
### Install Python
14
+

15
+
16
+
## ✅ Install Python
13
17
14
18
The core of dependency for Django is Python and we should install the interpreter first. Most of the systems come with Python already installed and we can easily check in the terminal:
15
19
@@ -18,9 +22,12 @@ $ python --version
18
22
Python 3.8.4 <-- All Good
19
23
```
20
24
21
-
If the version displayed in the terminal is Python2, please note that this version [has been discontinued](https://www.python.org/doc/sunset-python-2/) for versioning and development since Jan.2020. To download and install Python access the [official page](https://www.python.org/downloads/), select the installer that matches the operating system, and follow the installation setup. Once the process is finished, recheck the Python version in the terminal.
25
+
If the version displayed in the terminal is Python2, please note that this version [has been discontinued](https://www.python.org/doc/sunset-python-2/) for versioning and development since Jan.2020.
26
+
To download and install Python access the [official page](https://www.python.org/downloads/), select the installer that matches the operating system, and follow the installation setup.
27
+
28
+
Once the process is finished, recheck the Python version in the terminal.
22
29
23
-
###Manage Dependencies
30
+
##✅ Manage Dependencies
24
31
25
32
With **Python** up and running, we can install Django and other modules required by our development. The recommended way to install and manage the dependencies for a Python project is to use a virtual environment, a safe way to isolate the dependencies across multiple projects.
26
33
@@ -45,7 +52,7 @@ $ pip install django
45
52
46
53
The above command will install the latest stable version of Django. From this point, we can use all tools provided by Django to create a new project, apps and manage the project via Django CLI.
47
54
48
-
###Install a Code Editor
55
+
##✅ Install a Code Editor
49
56
50
57
This section has plenty of options from the old-school (yet modern) [Vim](https://www.vim.org/download.php) to [VsCode](https://code.visualstudio.com/) and [Atom](https://atom.io/). For those unfamiliar with any of these tools, VsCode might be a good choice to get started fast.
51
58
@@ -54,7 +61,7 @@ This section has plenty of options from the old-school (yet modern) [Vim](https:
A new project can be generated with ease in Django by using _django-admin_ that provides a collection of settings for the database, Django, and security layer.
60
67
@@ -92,7 +99,7 @@ At this point we should see the default Django page in the browser:
In the previous section, we've generated the core of the project that handles the configuration and now we will create the first Django application to serve a simple page to the users.
98
105
@@ -149,9 +156,10 @@ After saving all changes we should no longer see the Django default page (the on
149
156
150
157
.png>)
151
158
152
-
###Create New Model
159
+
##✅ Create New Model
153
160
154
-
Even simple applications require minimal storage for persistent data. Django provides _out-of-the-box_ an SQLite database, just to help us start fast. During this section, we will create and interact with a new table (model).
161
+
Even simple applications require minimal storage for persistent data. Django provides _out-of-the-box_ an SQLite database, just to help us start fast.
162
+
During this section, we will create and interact with a new table (model).
155
163
156
164
> Visualize the default SQL settings - `config/settings.py`
157
165
@@ -265,9 +273,7 @@ $ python manage.py shell
265
273
266
274
```
267
275
268
-
###
269
-
270
-
### Using Admin Section
276
+
## ✅ Using Admin Section
271
277
272
278
**Django** comes by default with a usable admin dashboard that allows us to manage all app models and users with ease. In order to access the module, a `superuser` should be created using the Django CLI:
273
279
@@ -308,7 +314,9 @@ admin.site.register(Book) # <- NEW
308
314
309
315
> Thanks for reading! For more topics, feel free to [contact](https://appseed.us/support) Appseed.
310
316
311
-
### Resources
317
+
##✅ Resources
312
318
313
-
- Read more about [Django](https://www.djangoproject.com/) (official docs)
314
-
- Start fast a new project using _development-ready_[Django Starters](https://appseed.us/admin-dashboards/django)
319
+
- 👉 Access [AppSeed](https://appseed.us/) and start your next project
320
+
- 👉 [Deploy Projects on Aws, Azure, and DO](https://www.docs.deploypro.dev/) via **DeployPRO**
321
+
- 👉 Create landing pages with [Simpllo, an open-source site builder](https://www.simpllo.com/)
Copy file name to clipboardExpand all lines: docs/content/tutorials/django-forms.mdx
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,22 @@
1
1
---
2
-
sidebar_position: 4
3
-
description: Learn how to manage forms in Django - For beginners
2
+
title : Django Forms
3
+
sidebar_label : Django Forms
4
4
---
5
5
6
6
# Django Forms
7
7
8
8
<SubHeading>Learn how to manage forms in Django - For beginners</SubHeading>
9
9
10
-
This page explains how to **manage and validate a form in Django** Framework. We assume the audience has already a Django project up and running. For those that start from nothing, feel free to access the resources mentioned below and come back here once the content is understood:
10
+
This page explains how to **manage and validate a form in Django** Framework. We assume the audience has already a Django project up and running.
11
+
12
+
For those that start from nothing, feel free to access the resources mentioned below and come back here once the content is understood:
11
13
12
14
- 👉 [How to install Django](django-how-to-install.mdx) - simple, tested steps to install Django
13
15
- 👉 [Django for beginners](django-for-beginners.mdx) - a comprehensive tutorial that covers the basics
14
16
15
-
> Topics covered by this tutorial
17
+

18
+
19
+
> **Topics covered by this tutorial**
16
20
17
21
- ✅ Create a new Django app
18
22
- ✅ Define a new route
@@ -25,7 +29,7 @@ The video presentation of this tutorial can be found on Github:
25
29
26
30
<YoutubeEmbedurl="https://www.youtube.com/embed/te350w1WwfQ"title="Django For Beginners - How to add a new form" />
27
31
28
-
## Create a new Application
32
+
## ✅ Create a new Application
29
33
30
34
> For this, we will use the `startapp` Django subcommand:
31
35
@@ -91,9 +95,7 @@ Once we restart the project, the new route `/forms` should be visible:
91
95
92
96

93
97
94
-
\
95
-
96
-
## Define a new form
98
+
## ✅ Define a new form
97
99
98
100
Inside the newly created app, we need to create a `forms` file and define the new Form Class object.
99
101
@@ -109,8 +111,6 @@ class HelloForm(forms.Form):
109
111
email = forms.EmailField(required=False)
110
112
```
111
113
112
-
\
113
-
114
114
> Controller code - `forms/views.py`, the `index()` method
115
115
116
116
```python
@@ -154,7 +154,6 @@ TEMPLATES = [
154
154
]
155
155
```
156
156
157
-
\
158
157
159
158
> HTML page - defined in `forms/templates` folder:
160
159
@@ -174,7 +173,6 @@ TEMPLATES = [
174
173
175
174
If all fields are provided, on submit, we should see the `Form is valid` message.
176
175
177
-
\
178
176
179
177
> Update the form with a new field `ID` (numeric type):
180
178
@@ -195,7 +193,9 @@ class HelloForm(forms.Form):
195
193
196
194
> Thanks for reading! For more topics, feel free to [contact](https://appseed.us/support) Appseed.
197
195
198
-
## Resources
196
+
## ✅ Resources
199
197
200
-
- Read more about [Django](https://www.djangoproject.com/) (official docs)
201
-
- Start fast a new project using _development-ready_[Django Starters](https://appseed.us/admin-dashboards/django)
198
+
- 👉 Access [AppSeed](https://appseed.us/) and start your next project
199
+
- 👉 [Deploy Projects on Aws, Azure, and DO](https://www.docs.deploypro.dev/) via **DeployPRO**
200
+
- 👉 Create landing pages with [Simpllo, an open-source site builder](https://www.simpllo.com/)
Copy file name to clipboardExpand all lines: docs/content/tutorials/django-how-to-install.mdx
+14-21Lines changed: 14 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,18 @@
1
1
---
2
-
sidebar_position: 1
3
-
description: The page explains how to install Django using a Virtual Environment
2
+
title : Django - How to Install
3
+
sidebar_label : Django Install
4
4
---
5
5
6
6
# Django - How to Install
7
7
8
8
<SubHeading>The page explains how to install Django using a Virtual Environment</SubHeading>
9
9
10
-
Django is a popular framework written in Python used to code modern and secure web applications much faster. Install Django is the first step of this journey and during this short tutorial, we will learn how to properly install Django using a Virtual Environment.
10
+
Django is a popular framework written in Python used to code modern and secure web applications much faster.
11
+
Install Django is the first step of this journey and during this short tutorial, we will learn how to properly install Django using a Virtual Environment.
11
12
12
-
> Content Features:
13
+

13
14
14
-
- Level: **beginners**
15
-
- Mentioned Topics:
16
-
17
-
- Django
18
-
- Virtual Environment
19
-
- Basic command-line commands
20
-
21
-
### What is Django
15
+
## ✅ What is Django
22
16
23
17
For newcomers, Django is a popular framework built by experienced developers, actively supported by an impressive open-source community. Django comes with _batteries included_ concept and provides modules to handle the **database**, **authentication**, **built-in security**, plus a powerful command-line interface to interact with our app. To start learning Django feel free to access:
24
18
@@ -28,7 +22,7 @@ For newcomers, Django is a popular framework built by experienced developers, ac
28
22
29
23

30
24
31
-
###Virtual Environments
25
+
##✅ Virtual Environments
32
26
33
27
A virtual environment helps us to keep isolated the dependencies used by different Python projects. A simple `use case` might be this one: we have installed locally two Python apps that use different versions of a common library, Django for instance. Without using a virtual environment the only choice is to install the dependencies in the global environment and this might affect the stability and behavior of both apps.
34
28
@@ -60,7 +54,7 @@ $ .\env\Scripts\activate
60
54
(env) $
61
55
```
62
56
63
-
###Install Django
57
+
##✅ Install Django
64
58
65
59
The recommended way to install Python packages is to use PIP, the official package manager for Python.
66
60
@@ -100,7 +94,7 @@ The removal of a Python package can be done with ease via `pip`:
100
94
101
95
At this point, Django is no longer available in our virtual environment.
102
96
103
-
###Deactivate Virtual Environment
97
+
##✅ Deactivate Virtual Environment
104
98
105
99
Once the work is finished, to leave the virtual environment we need to type:
106
100
@@ -114,10 +108,9 @@ After running `deactivate` command, the console prefix should be removed by the
114
108
$ # no environment prefix
115
109
```
116
110
117
-
### Resources
118
-
119
-
To learn more about Python, **Virtual environments,** or get support, please access:
111
+
## ✅ Resources
120
112
121
-
-[Python](https://www.python.org/) - official website
122
-
-[Virtual Environments](https://docs.python.org/3/tutorial/venv.html) - official docs
123
-
- Join [AppSeed](https://appseed.us/) and ask for [support](https://appseed.us/support) - for **registered users**
113
+
- 👉 Access [AppSeed](https://appseed.us/) and start your next project
114
+
- 👉 [Deploy Projects on Aws, Azure, and DO](https://www.docs.deploypro.dev/) via **DeployPRO**
115
+
- 👉 Create landing pages with [Simpllo, an open-source site builder](https://www.simpllo.com/)
0 commit comments