understanding django models versus python sql commands

I’m trying to understand django models. Seems awfully convoluted. If you add records to the database just using standard python3 sql commands does it cause any problems with django? If I create a table using python3 sql commands do I need to create a migration with django? This is where I get confused, what exactly is the purpose of using django models? Seems like it’s a manual process. Hardly scalable.

if users enter data from a website do you use django python commands or do you use standard pthon sql commands?

Brian says in lecture 4 (CS50-web 2020) this is where the real power of django comes in. It provides a layer of abstraction that allows us to use python commands instead of having to worry about the underlying sql.

Well, Brian says so, so it’s probably true. Be nice to see some evidence of that. It seems that django models are a black hole. and not very useful. We are trying to build websites. So how do you add data to tables when a user enters data?

can someone point to a more complete tutorial on django models? Honestly, the lecture 4 is a waste of time. Lot’s of information but it raises more questions then it answers. Doesn’t provide a framework for how or why one would use django models.

I’ve found the easiest way to start to understand the Django ORM Is by working through either (or both!) of the official Django Tutorial and the Django Girls tutorial. It’ll have you creating models and entering data through web forms, as well as querying that data. Once you’ve completed either one of them, you’ll see how easy it is to use.

2 Likes