Registration and database – part one

Hello! In the previous post, we created a basic login system (which still has few bugs) and a responsive site. Today we are going to dive into a registration and fix some errors in login. Let’s do it!

During registration, we’d like to get from user his nickname, name, surname, email and password. Therefore we have to create a new file called ‘forms’. The code is a little bit more complicated than log in. If you are interested visit my github profile.

We will use again built-in authentication system. It includes registration forms. After few minutes I’ve got a basic view.

It’s really unattractive, isn’t it? Don’t worry- quick setup and we’ve got something like this. A panel in ‘materialize’ style.

Much better. Now we’d like to get more info from users. We just need to add some extra fields.

Perfect! Looks very attractive to me. I also added a log out button but there is a bug. After ending the session we can go back and see still see our page. It’s because of ‘cache’ Fortunately there are decorators in Python. Thanks to it we can block attempts to return to the previous page. We just have to add some extra line to our code.


The name of this method is clear – it requires to be logged in 🙂

To sum up, we can log in and sing up. We are safe – no one can see our profile after logging out. It’s time to create a database – we have to save our transactions somewhere. Our table should has the following fields:

  • Name of the commodity
  • Price
  • Date
  • Description

In the next post, we will create database and two templates – dashboard and adding-transaction site. That’s all for today! If you have any questions or ideas- just let me know! 🙂