First transactions and a little bit of fun

Hi! In the previous note we, we took care of valid authentication and registration. Today we’re going to create saving transactions to a database and a dashboard, where we will use a very interesting tool. It will bring some life to our app and also make a lot of fun. Let’s do it!

In order to save our expenditures, we have to create models. They are objects, which are saving to our database. At the beginning, we’d like to store a name of the commodity, it’s price, date of purchase and an optional description. Our model will look like this:

After creating this part, we have to make migrations. It means, that we save changes to the database. After necessary command, we can check immediately in Django ORM (it’s a console), if our actions work.

Perfect! We can see, that our transaction was saved. Let’s look at the admin panel and check how does it look like.

Everything works fine! So it’s time to create a page. It will allow the user to add transaction after login.

I’ve worked a lot on this task. I’ve never had a contact with Django forms nor created adding to database from web browser. But I did it (trust me- it was very hard) and there is the final result:

Sweet 😉 Finally, here is our tool. I didn’t want to have a boring dashboard, so I’ve started to search. I’ve found Packery. It’s a great plugin, which allows configuring elements on the page in any way. Just look at this:

Great 😉 It’s over! In the next post, we will be making some interface changes. If you have any questions, feel free to ask 🙂 Bye!

Leave a Reply

Your email address will not be published. Required fields are marked *