I Left My Body In Your Care - Django Objects

I Left My Body In Your Care - Django Objects

(quoting the song "Yellow Mile" by Marika Hackman because it's just so beautiful and you should listen to it omg).

I learned a valuable lesson today.

One that I have known for many years but it is still good to get a refresher. It's always worth opening your heart. We have plans and we go through life with them.

But it's always good to open your heart. But when life gives you the opportunity to open your heart and to show some love and to show some love to someone and to help someone then you should always take it. Because  - that is where the real growth lies. 

That is where the real progress lives.

And it is always worth opening your heart to someone and helping them if and when you possibly can. If I think of my mentor - I see how ready and willing he always is to help me - I see how many software engineers he is always willing to help every single day.

And he is one of the most amazing engineers I know. And I wish more engineers knew this - helping others will always, always make you a better software engineer than you were before.

And life is what happens when you are busy making other plans. 

Django ORM and QuerySets

Yay! I finally made it on to the right part of my tutorial! Yay yay yay YAYYYYY thank you. What is a QuerySet? "A QuerySet is, in essence, a list of objects of a given Model." YAYYYYYYYYY YAY NOW I FINALLY KNOW THANK YOU. YAYYYYYYYYYYY

"QuerySets allow you to read the data from the database, filter it and order it." YAYYYYYYY NOW I FINALLY KNOW NOW YAY YAY THANK YOU THANK YOU THANKS. YAY.

I am off on annual leave tomorrow but this is a wonderful thing to have learned. But not quite done yet. Still have a bit of work time left so here let me try it out. 

I practised a bit of Django 

Not much but I managed to do a bit of this - 

Note that the Python shell has never really been my strength as a formerly JavaScript/TypeScript and FrontEnd developer but I am learning now.

Firstly this is how you call the Python command line shell:

python manage.py shell

Well, if I'm going to be becoming an expert in Python then I may as well learn how to do this properly! Thanks!!!
  • importing things in the command line like from blog.models import Post
  • Using things like Post.objects.all() which will fetch me all of the objects from a certain model
  • ie every row in a table
  • ie every instance of a certain class
  • I then defined "me" as a variable and I set it to my username as a string ie to me.
  • Post.objects.create(author=me, title='Sample title', text='Test')
I don't think I got onto any of the methods yet that my mentor really wanted me to try out and see. To test and to learn.

Like save(), filter() and get()...

But they'll be waiting for me when I get back from holidays.

Thank you so, so, so SO much - I love you all - thank you. Thank you for reading thank you so much. xxx

A QuerySet is, in essence, a list of objects of a given Model. - This text is from Django Girls tutorial - orange background with pink symbols and quotation marks and a bright green image of code.


Comments

Popular posts from this blog

Hello World

Yosemite

Where To Hide A Star