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: load_multiple_users.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -784,12 +784,12 @@ Add a login link for both the student and the teacher in the `base.html` file.
784
784
{% endblock %}
785
785
```
786
786
787
-
Notice how I have used the `if` statement to check if the user is a student or a teacher. If the user is a student, he will be redirected to the `index_student` page. If the user is a teacher, he will be redirected to the `index_teacher` page. If the user is not authenticated, he will be redirected to the `login_student` or `login_teacher` page.
787
+
Notice how we have used the `if` statement to check if the user is a student or a teacher. If the user is a student, he will be redirected to the `index_student` page. If the user is a teacher, he will be redirected to the `index_teacher` page. If the user is not authenticated, he will be redirected to the `login_student` or `login_teacher` page.
788
788
789
789
790
790
### Flash Messages
791
791
792
-
To display the flash message seen earlier, I will update the `block content` with the following code:
792
+
To display the flash message seen earlier, we will update the `block content` with the following code:
793
793
794
794
`base.html: Flash Message`
795
795
```html
@@ -814,11 +814,11 @@ To display the flash message seen earlier, I will update the `block content` wit
814
814
{% endblock %}
815
815
```
816
816
817
-
I retrieve the flash messages from `get_flashed_messages()` function and save them in a `messages` variable. I can then loop through the messages and display them.
817
+
We retrieve the flash messages from `get_flashed_messages()` function and save them in a `messages` variable. We can then loop through the messages and display them.
818
818
819
819
### Update The Homepage
820
820
821
-
At the moment, both the teacher and the student have access to the same home page. I would like to ensure that each user has access to the right home page, in the event that we may consider to use this page as a dashboard where only the current user's information if to be viewed.
821
+
At the moment, both the teacher and the student have access to the same home page. We would like to ensure that each user has access to the right home page, in the event that we may consider to use this page as a dashboard where only the current user's information is to be viewed.
822
822
823
823
Let us update our `routes` module.
824
824
@@ -849,13 +849,13 @@ def index_teacher():
849
849
)
850
850
```
851
851
852
-
I have used the `login_required` decorator to ensure that the user is authenticated before accessing the home page. Let us create these two templates.
852
+
We have used the `login_required` decorator to ensure that the user is authenticated before accessing the home page. Let us create these two templates.
In these templates, we are going display some of the user's information. Add these information to both templates, changing where appropriate. I will show you how to display a student's information below.
858
+
In these templates, we are going display some of the user's information. Add these information to both templates, changing where appropriate. We will show you how to display a student's information below.
0 commit comments