#100DaysOfCode in Python Transcripts
Chapter: Days 85-87: Fullstack web apps made easy
Lecture: Creating the document

Login or purchase this course to watch this video and the rest of the course contents.
0:00 All right, looks like our categories are working, so we can delete that bit. Now, here we have the To-Do, Create a Document.
0:08 What we need to do because the security we put on our document, our database, we need to put over here.
0:14 Let's get rid of this output so we have more room... ...to our data layer and add one more function, and just for time's sake, I'll paste this in,
0:21 it's really simple. So we're going to call Add a Document, and it's going to take a Category Name, a Contents, and a Views. We also have that created
0:29 which we're going to generate on the server, and a little print of what we're going to do. And then we'll come over here,
0:35 and we'll call Category by Name, give it a category name 'cause when you have these linked tables, you can't just put a value
0:42 that would determine their relationship, you actually have to put the row, so we're going to get the row back, and then set the relationship this way.
0:50 And we have... Make sure we have this right here... Name, Created, Content, Views, and Category. So this needs to be Name, Content, Views,
1:00 Created, and Category. It looks good. So we're just going to go and create this. Now, all we have to do is call this Add Doc here. There it is.
1:16 And what does it take? It's going to take- Look at that, it's pretty awesome to show this- it takes the document name, Name, Category,
1:24 Contents, and Views, and let's just put zero for views when we create it. So Name, something like that,
1:45 So this selected value here, that's just going to be the name, and that's what we'll use in our look-up on the server site, and the Content.
1:59 Something as well. All right, so that should do it. Let's see if this works. So this is going to be some documentation.
2:13 All right, let's see if this works. Create Document, ha-ha, datetime and Data Layer. Yes, yes. Import datetime. So close, let's try again.
2:29 Alright, let's try it with this. Boom. Look at that. On the server it says it's creating the new document. Does that really mean it was created?
2:37 Let's go to the database. Oh my goodness! There it is. Look! That's it. And we linked it over to the documentation. Now even the categories.
2:51 That's so super awesome. Love it.


Talk Python's Mastodon Michael Kennedy's Mastodon