Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Using SQLAchemy
Lecture: Working with package details
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
So far we've seen our homepage
0:01
is looking really sweet.
0:03
We don't have that much data yet
0:04
but it is data driven
0:06
and this is coming out of the database.
0:07
However, when we pull up the details
0:10
for one of the packages under project/{package_id}
0:13
well the details are not so much.
0:15
So that's what we're going to focus on in this video
0:18
on how to fix this.
0:19
Now, the actual design for this page
0:23
remember, remind you what this looks like
0:29
it looks like this.
0:30
It's got this little install instruction
0:31
whether or not it's the latest version
0:33
the ability to see all the releases
0:35
the details, the homepage, the maintainers
0:39
and so on, and so on.
0:40
All of this stuff.
0:41
It turns out the actual web design to do all that
0:45
would take quite a while
0:46
and we already spent a ton of time
0:47
back in the adding design
0:50
after the bootstrap chapter that we already did
0:53
on the homepage and this is really pretty similar.
0:55
So what I'm going to do is just quickly talk you through
0:57
what we got here. So here is some more html.
1:00
We're using the same, sort of, hero concept.
1:03
This time we've got that little install bit.
1:06
Whether or not it's the latest release
1:08
and how to switch from that. Same little stats.
1:11
Here instead of having the numbers though, we have the summary.
1:14
And the maintainers and we have the side bar
1:17
navigation thing. And then somewhere down here
1:20
we have the project details.
1:22
And we're using structured output html like stuff.
1:25
Now if this was just marked down
1:27
to be real easy to convert it to html
1:29
and actually show it properly formatted
1:31
but because most of it's restructured text
1:33
and I haven't found a good library for that
1:36
I just threw it into a pre
1:37
so we can just read it, all right.
1:39
So it's not going to be perfect but it's close enough.
1:42
So with this in place, you think we could load it up
1:44
but in fact, if I rerun it here
1:49
it's going to run into some problems.
1:50
'Cause we don't have the data.
1:52
Right so wait hold up, we need the actual package object
1:54
from the database. You just gave us a fake name.
1:57
This is not really the package object.
1:59
Our goal will be to implement the data access layer
2:03
and pass the right amount data over
2:05
make this view happy, right.
2:07
So working our package service and our controller.