Detailed Notes
We build out some master-detail form links as we improve the user experience for our application.
You can view source for today and all prior days by reviewing the tag Day 34 at this GitHub: https://github.com/robbroadhead/develpreneur-pythontutorial
Transcript Text
[Music] hello and welcome back we are continuing digging into our application getting a little deeper into the django and python world this time around we're going to look at cleaning stuff up a little bit and we're going to look at our road maps if you remember last time around we have these high level time frames right for example annual goals but what we'd like to do is make it so that we can make children out of the higher level so we could have anal goals and then have you know quarters with under under that months under that now what we want to do is let's take a look at our model because one of the things we have to do with our time frame as we talked about is we have to create a parent so we're going to go in and create a we've done this done our migration so we now have uh within like if i look at my database figure out what i to remind myself what i set this up as i set it up as uh root and with that is the password and so now if i use dp project if i look at the time frame there you go that one then i can see i've got my parent id and if we look here and we edit uh for example first quarter then i can set a parent which i have done to overall goals but now i need to be able to actually display this in some way so if i go back to my time frames if i look at annual goals right now it's actually not doing anything because i need to walk through it has to have a road map it's looking for road map associated with it so i've sort of blown up my time frames list because now i'm going to want to go through here so let's get rid of time frames off of navigation and if we go to probably it's in base somewhere down here oh is that the right base that is the right base let's try oh we called it internal so let's get time rid of time frames because we're going to actually access them through our roadmaps and now what we want to do is we want to as we go in we want to within a road map one of the things we're going to do which we've seen is we're tying the road map well we also well first let's clean this list up so this is this list of time frames we need everybody that does not have a parent so uh let's go into our roadmap list oh actually we need to go into our view and when we look at our roadmap list roadmaps we want here except for all we're going to do get where parent and i think we called it parent yeah actually i think we call it parent let's try that should we probably do parent id but let's try let's see oh okay so it's not parent so if we go to a row oh i'm sorry it's not roadmap objects it's not roadmap it is uh let's see that's all that's road maps but i want uh let's list road maps when i do an edit uh sorry view roadmap i'm gonna have a list let's look at that here's edit roadmap so within roadmap i have here we go time frames where roadmap is equal to the data and i want where parent goes no let's see if that works for us and i think we're running we are we're updated and if we reload that oh i'm sorry it's not it's not i want it to about it evaluates uh let's see so back to views it's actually is null and i want to filter where is null equals true because if it's then that's going to give me a top level and so now i'm going to see only my overall annual goals now what i need when i step into here is i need child time frames so within a time frame i'm now going to uh if i look at edit time frame go to edit time frame i now need we're going to call it children and that is going to be a time frame dot objects that filter where parent equals this and parent is going to be uh let's see time frame where did i get the id data timeframe data yes so data and then i need to send this and so now uh we're gonna do this this way so we've got a parent and we've also got a road map which is gonna be a little different so so we're going to add one more which is going to be let's see do we need to chill we probably don't really need to send that okay so parent will be roadmap we can do this we can work with this it's gonna be a little bit confusing well let's do that let's change this to roadmap and parent is going to be roadmap because now we're going to have a roadmap that you belong to but your parent could be a time frame or a null so let's see parent roadmap roadmap roadmap is a roadmap uh that gives me now road map of children so now i'm going to go to time frame edit the first thing i do is that parent id is actually roadmap id roman name uh let's see do i have parent elsewhere that's if road map and then i need to do the same thing for my parent so i do the same thing here as i'm just going to do if parent actually if it's actually this it's if who am i i am form is that what i call it let's make sure we got that right let's go to views i send form i did not send data so i think i can just do form.parent uh let's see where did that go if oh it formed out parent and this is gonna be i think i called it time frame or tf let's go look here yeah tf and that's going to be form dot parent i id let's keep that simpler i'm going to actually send i am going to send the parent in so i'm not having to play around with that too much go page tf blah blah blah so let's go back here and let's just make this parent is actually pretty easy because it's just going to be data dot parent whoops that parent and notice we're getting a little bit long we could change this stuff around a little bit and simplify it uh we could send some stuff we could actually store some stuff like the map for example we might want to at some point restore stored as a session variable or something along those lines just so we're not passing stuff around but for now let's see that goes there we're going to keep it as is and we go back to our time frame edit so we get that uh and now we have children so this is gonna be we're gonna call this um we're gonna get a couple of br's here split up a little bit and this is gonna be create time period period which i think we just call that tf and we'll clean that up a little bit later we're going to do this this is uh we will call this uh let's call this child time frames for now and we're going to basically steal this and put it right under here and we're going to say if children we can probably steal from so this is a time frame list let's go back to the road map edit and let's do it this way let's steal this one actually we can steal that whole thing let's go back here and that's going to be child time frames and then all i need to do is if instead of if whoops instead of time frames it's going to be if children and then for tf and children no child time frames and now we're gonna be able to go to road maps go to annual goals and we're gonna see uh did we not say oh we're gonna go to annual goals within the road map and then we can see child time frames we're gonna see first quarter it has no children tile frank child time frames but it does have some tasks underneath it and if we go back here i think one of the things we want to do which is where it may be useful to set a a session variable is for example this time frame overall annual goals is good it comes up with nothing but if i create time frame what i would like is for parent to be oh and it's not doing it right now so when i do create time frame oh i did not give my slash um so i'm going to actually go here and let's just reload that and go to create time frame and so i would like my rode my parent and my roadmap to get preset and that is what we're going to look at next time around so i hope you enjoyed this we will continue digging into this a little bit further moving a little you know moving the ball forward on our application as always go out there have yourself a great day and we will talk to you next time you
Transcript Segments
[Music]
hello and welcome back
we are continuing digging into our
application getting a little deeper into
the django and python world
this time around we're going to look at
cleaning stuff up a little bit
and we're going to look at our road maps
if you remember last time around
we have these high level time frames
right for example annual goals but what
we'd like to do is make it so that we
can make
children out of the higher level
so we could have anal goals and then
have you know quarters with under
under that months under that now what we
want to do
is let's take a look at our model
because one of the things we have to do
with our time frame
as we talked about is we have to create
a parent
so we're going to go in and create a
we've done this
done our migration so we now have uh
within
like if i look at
my database
figure out what i to remind myself what
i set this up
as
i set it up as uh
root and with that is the password
and so now if i use dp project
if i look at the time frame
there you go that one then i can see
i've got my parent id
and if we look here and we edit
uh for example first quarter then i can
set a parent
which i have done to overall goals but
now i need to be able to actually
display this
in some way so if i go back to my time
frames if i look at annual goals
right now it's actually not doing
anything because i need to walk through
it has to have a road map it's looking
for road map associated with it so i've
sort of blown up my time frames list
because now i'm going to want to go
through here so let's get rid of time
frames off of navigation
and if we go to probably it's in base
somewhere down here
oh is that the right base that is the
right base let's try
oh we called it internal
so let's get time rid of time frames
because we're going to actually
access them through our roadmaps and now
what we want to do
is we want to as we go in we want to
within a road map one of the things
we're going to do which we've seen
is we're tying the road map well we also
well first let's clean this list up so
this
is this list of time frames we need
everybody that does not have
a parent so uh
let's go into our roadmap list
oh actually we need to go into our view
and
when we look at our roadmap list
roadmaps we want here
except for all we're going to do get
where parent and i think we called it
parent
yeah actually i think we call it parent
let's try that should we
probably do parent id but let's try
let's see
oh okay so it's not parent so if we go
to a row oh i'm sorry it's not roadmap
objects
it's not roadmap it is
uh let's see that's all that's road maps
but i want uh let's list road maps when
i do an edit uh sorry view roadmap
i'm gonna have a list let's look at that
here's edit
roadmap so within roadmap
i have here we go time frames where
roadmap is equal to the data
and i want where parent
goes no let's see if that works for us
and i think we're running we are we're
updated
and if we reload that oh i'm sorry it's
not it's not i want
it to about it evaluates uh let's see so
back to views
it's actually is null
and i want to filter where is null
equals
true
because if it's then that's going to
give me a top level
and so now i'm going to see only my
overall annual goals now what i need
when i step into here
is i need child time frames so within a
time frame
i'm now going to uh if i look at edit
time frame
go to edit time frame i now need we're
going to call it
children
and that is going to be a time frame
dot objects
that filter where
parent equals this
and parent is going to be uh let's see
time frame where did i get the id data
timeframe data yes so data
and then i need to
send this
and so now uh we're gonna do this this
way so we've got a parent and we've also
got
a road map which is gonna be a little
different so
so we're going to add one more which is
going to be
let's see do we need to chill we
probably
don't really need to send that
okay so parent will be roadmap we can do
this we can work with this it's gonna be
a little bit confusing well let's do
that let's change this to
roadmap and
parent is going to be roadmap
because now we're going to have a
roadmap that you belong to but your
parent could be a time frame or a null
so let's see parent
roadmap
roadmap
roadmap is a roadmap
uh that gives me now road map of
children so now i'm going to go to time
frame edit
the first thing i do is that parent id
is actually roadmap id
roman name uh let's see do i have parent
elsewhere
that's if road map
and then i need to do the same thing for
my parent so
i do the same thing here as i'm just
going to do if
parent
actually if it's actually this it's if
who am i i am form
is that what i call it let's make sure
we got that right let's go to views
i send form i did not send data so i
think i can just do form.parent
uh let's see where did that go if oh
it formed out parent
and this is gonna be i think i called it
time frame or tf
let's go look here yeah tf
and that's going to be form
dot parent i id let's
keep that simpler i'm going to actually
send i am going to send the parent in
so i'm not having to play around with
that too much
go page tf blah blah blah so let's go
back here and let's just make this
parent is actually pretty easy because
it's just going to be data dot
parent whoops
that parent
and notice we're getting a little bit
long we could change this stuff around a
little bit
and simplify it uh we could send some
stuff we could actually store some stuff
like the
map for example we might want to at some
point restore stored as a session
variable or something along those lines
just so we're not passing stuff around
but for now
let's see that goes there we're going to
keep it as is
and we go back to our time frame edit
so we get that uh and now we have
children
so this is gonna be
we're gonna call this um we're gonna get
a couple of br's here
split up a little bit and this is gonna
be create
time period period
which i think we just call that tf and
we'll clean that up a little bit later
we're going to do this
this is uh
we will call this uh let's call this
child time frames
for now and we're going to basically
steal this
and put it right under here and we're
going to say if children
we can probably steal from so this is a
time frame list let's go back to the
road map edit and let's do it this way
let's steal
this one
actually we can steal that whole thing
let's go back here and that's going to
be child time frames
and then all i need to do is if instead
of if whoops instead of
time frames it's going to be if children
and then for tf and children
no child time frames
and now we're gonna be able to go to
road maps
go to annual goals and we're gonna see
uh
did we not say oh we're gonna go to
annual goals within the road map
and then we can see child time frames
we're gonna see first quarter
it has no children tile frank child time
frames
but it does have some tasks underneath
it
and if we go back here i think one of
the things we want to do which is where
it may be useful to set
a a session variable is for example this
time frame
overall annual goals is good it comes up
with nothing but if i create time frame
what i would like
is for parent to be oh and it's not
doing it right now so when i do create
time frame
oh i did not give my slash um
so i'm going to actually go here
and let's just reload that and go to
create time frame
and so i would like my rode my parent
and my roadmap
to get preset and that is what we're
going to look at
next time around so i hope you enjoyed
this we will continue digging into this
a little bit further moving a little
you know moving the ball forward on our
application as always go out there have
yourself a great day
and we will talk to you next time
you