Detailed Notes
We continue cleaning up our master-detail relationships with filtered queries and pre-populating values.
You can view source for today and all prior days by reviewing the tag Day 35 at this GitHub: https://github.com/robbroadhead/develpreneur-pythontutorial
Transcript Text
[Music] well hello and welcome back today we are continuing uh building out some of our interface trying to add to the user experience a little bit uh it's starting a little busy we're going to clean this up but this time first we're going to get some default values set in and this is going to be pretty straightforward so we start from road maps if we create a road map we want the i'm sorry within create a roadmap we actually want to add ability to create a time frame we can create a roadmap so let's add time frame because we're going to pass these things down quite a bit and actually we're going to steal from the time frame itself so we're going to steal from edit time frame time frame edit create time frame we are going to steal that guy and we're going to go back to our roadmap edit and we're going to give ourselves oh that's create time frame that's not what we want we actually wanted to create i think it's called roadmap i grabbed the wrong one let me look at that real quick so if i come to here oh that's a time frame oh this is a so i'm in roadmap create a roadmap oh i'm sorry so this is a roadmap i forgot so now i'm in a roadmap and i want to be able to create a time frame which is good uh let me go back to here that's not what i wanted my mistake um but ignore that little singing thing so now i am in a road map and when i want to create a time frame i want to create it with this road map annual goals as uh did i just break that so create time frame oh i'm sorry i must have saved that halfway along so if i go here there we go now if i create a time frame but i want my roadmap to be set so what i'm going to do is i'm going to do it simply right now is i'm going to add some query parameters which we have done in the past so here in the roadmap edit as i come into my list for each of these when it does a go page then i want it to be oh i do have that oh that i'm sorry that's the edit when i do new i'm going to steal this here and i'm going to give myself that id so now if i look at tf and actually that may be i think we already built that in so let's see so now if i do create time frame oh i just have not set it so now i need to go to the view because i am sending a rm value when i do time frame whoops time frame uh this is gonna be here so if i do edit time frame when i set my when i pull my data um did i create a new one here let's see so oh let's go look at my urls real quick so if i look at time frames i had tf does a create time frame so if i look at create time frame here it is in this case i'm going to go look for my variable which is similar to this thing right here so now what i'm going to do is come in and say uh let's see whoa create time frame i create my blank right here and then what i'm going to do is i'm just going to say is if i've got an rm in there then i don't know why i called it that but i'm going to do a roadmap id i'm going to get it and then for that data i'm going to set its roadmap equal to roadmap and let's just make this ram uh let's call it road m for now okay so what i'm doing here is i'm going to set its parent i assume that's what it is uh let's see go look oh no that's right okay so it's going to come through and now when i look at it here uh let's see so from road maps edit so this should be if i create a time frame now we're going to see my annual goals and boom we see that there so in the same vein when i come into my overall annual goals and i see a list of tiled time frames when i create a time frame i want it to be this parent so i'm going to do essentially the same thing if i go to time frame edit now within here if i create a child time frame then i'm going to be parent equals which is going to p i'm going to be looking for a variable p and that's going to be within this it's going to be form dot id and we'll double check that i think that's going to get it for us and then let's see so that's just on the crate i don't need to do anything else there i don't think okay so now i just need to handle the p in the time frame create oop and views uh there it is create time frame so let's take that same section of code basically and in here if it's if i have a get p then in this case it's going to be the parent and he's going to be a time frame whoop dot objects.get equals parent id i missed something oh okay that was just a typo and then i want to set the parent for data oops to the parent pretty straightforward uh we've probably seen this before we're just in other applications uh but this is just sort of clean this stuff up so now if we go to road maps and i go here so that's my annual goals i've got overall annual goals i've got the first quarter which if i edit it he points back to the overall if i go if i create a time frame here and so first instead of seeing if it just exists that way i have to see if the index exists so i'm actually going to use this i think elsewhere i need to do an n let's see where else did i use that so this is if rm is in there and that's probably it yeah because i already did that in a couple of these other places i just did not do it correctly okay so fixing that save it let's go back here let's refresh if i do an edit uh everything's good if i do a create let's actually inspect this real quick because i'm not sure that's built right uh so it's not building this so in child time frames let's go look at that in edit time frame oh i don't think i saved it that may be the problem so let's look at this again this time i'm getting a p parent equals a null which is probably not right oh yes it is uh so i go here and the problem is is that parents should be equal to this not a null so i want to come in here and uh it's actually form.id which is not what i want actually i think i just called that did i call that id let's find out real quick i may have actually sent that in already uh if i go to time frame edit time frame id is that what that is yeah so it's tfid just to keep it simple so i'm just passing it in that way and now i should see um my parent is one uh because this is time frame one so if i look here parent equals one and so now if i do create a time frame for second quarter then i've got this i don't have my roadmap yet so i'm going to create this real quick i am going to set it as the goals period is going to be quarterly and save the record and so now if i go back to my roadmaps which i'm going to want to be able to do this a little differently but if i look at my overall annual goals now i see first and second quarter now what i also want to do is be able to set the roadmap so it's going to be the same thing here and i'm going to do ampersand rm equals which i think i already used it yep right here rmid so i bet i may already have it set up which would be good so if i go and create let's sit this way and do third quarter goals uh oh it's not oh did it not i may not have set the value right so let's go look at this again let's look at this again uh let's see so child time frames oh that's create time frame which is good yeah which is good uh ampersand rmi rm equals rmid so maybe the roadmap's not coming through right that may be the problem yes i don't have rmid passed into here for some reason so let's see where i did so there's rmid equals that that's with edit a road map oh that's easy enough to fix so if i come into create then uh let's see let's create time frame time frame edit uh yes oops so let's edit i'm sorry there's edit time frame okay time frame so he probably wants to send the same thing actually so if i send all of that in well i really don't need all of that so let's like let's get rid of that my mistake so let's go in here and we need to do we do need um am i not calling create time frame one second while i'm looking at this i've been doing tf edit if i do tf with the create let's make sure what i'm doing here uh so if i do create time frame here he's just doing a tf so he should be hitting it at yes so okay so i changed the wrong code i think let's see uh 299 and create frame so if we go here 299. so it is in create oh no i'm good i'm good except i'm not passing all that stuff in so i'm building all this stuff out well but i don't need children but i do need oh because i'm doing that a little bit differently so i probably don't need all of those so i can actually come in here uh let's take a look at this real quick pid rid oh it's already an ant so i don't need that i don't need that let's keep this guy the same as he was let's see i think that'll work let's try that it's probably something undefined variable task nope and roadmap good good good id expected a number but got blank so when i do the r i'm getting up oh my road map's coming back blank so if i go back here oh i have to go all the way up i think roadmap there so he has roadmap id if i do create time frame he's not sending that in right so it should be rm equals one should sit there oh because i'm not that's right when i come down here so i have an rm but i need to have uh what did i call that so we're gonna come in here now we set our roadmap id uh annual goals got uh overall annual goals for to create time frame and now we have overall annual goals and annual goals so we've set everything up and we are off and running so now we've got some of our basics the next thing we want to do is we'll come back around next time and for our task we're going to go ahead and pass down our time frame but we've run out of time this time dug through stuff a little bit next time we're going to quickly uh probably kind of swing through that and we're going to clean up a couple of things as well and then continue moving forward so as always you can check out the latest we are up today this will be tagged for day 35 and you can grab that out of github take a look at the source and as always go out there have yourself a great day and we will talk to you next time you
Transcript Segments
[Music]
well hello and welcome back
today we are continuing uh building out
some of our interface
trying to add to the user experience a
little bit uh it's starting a little
busy we're going to clean this up but
this time first we're going to get some
default values set in
and this is going to be pretty
straightforward so we start from road
maps
if we create a road map we want the
i'm sorry within create a roadmap we
actually want to add
ability to create a time frame
we can create a roadmap so let's add
time frame because we're going to pass
these things down quite a bit
and actually we're going to steal from
the time frame itself so we're going to
steal from edit time frame
time frame edit create time frame we are
going
to steal that guy and we're going to go
back to our roadmap
edit and we're going to give ourselves
oh that's create time frame that's not
what we want we actually wanted to
create i think it's called roadmap
i grabbed the wrong one
let me look at that real quick so if i
come to here
oh that's a time frame oh this is a
so i'm in roadmap
create a roadmap oh i'm sorry so this is
a roadmap i forgot
so now i'm in a roadmap and i want to be
able to create a time frame which is
good
uh let me go back to here that's not
what i wanted
my mistake um but ignore that little
singing thing
so now i am in a road map and when i
want to create a time frame
i want to create it with this road map
annual goals as
uh did i just break that so create time
frame
oh i'm sorry i must have saved that
halfway along
so if i go here
there we go now if i create a time frame
but i want my roadmap to be set
so what i'm going to do is i'm going to
do it simply right now is i'm going to
add some query parameters
which we have done in the past
so here in the roadmap
edit as i come into my list
for each of these when it does a go page
then i want it to be oh i do have that
oh that i'm sorry that's the edit
when i do new i'm going to steal this
here
and i'm going to give myself that id so
now if i look at
tf and actually that may be i think we
already built that in so let's see so
now if i do
create time frame oh i just have not set
it so now
i need to go to the view because i am
sending a
rm value
when i do time frame
whoops
time frame uh this is gonna be
here so if i do edit time frame
when i set my when i pull my data um
did i create a new one here let's see so
oh let's go look at my urls real quick
so if i look at time frames i had
tf does a create time frame so if i look
at create time frame here it is
in this case i'm going to go look for my
variable which is similar to this thing
right here so now what i'm going to do
is come in and say
uh let's see whoa create time frame i
create my blank
right here and then what i'm going to do
is i'm just going to say
is if i've got an rm in there
then i don't know why i called it that
but i'm going to do
a roadmap id
i'm going to get it and then for that
data i'm going to set
its roadmap equal to
roadmap and let's just make this ram uh
let's call it road m
for now okay
so what i'm doing here is i'm going to
set its
parent i assume that's what it is
uh let's see go look oh no that's right
okay so it's going to come through and
now
when i look at it here
uh let's see so from road maps edit so
this should be
if i create a time frame now we're going
to see my annual goals
and boom we see that there
so in the same vein when i come into
my overall annual goals and i see a list
of tiled time frames
when i create a time frame i want it to
be this parent
so i'm going to do essentially the same
thing if i go to
time frame edit now within here if i
create a child
time frame then i'm going to be parent
equals
which is going to p i'm going to be
looking for a variable p
and that's going to be within this it's
going to be
form dot
id
and we'll double check that i think
that's going to get it for us and then
let's see so that's just on the crate i
don't need to do
anything else there i don't think okay
so now i just need to handle the p
in the time frame create oop
and views uh there it is create time
frame so let's take
that same section of code basically
and in here
if it's if i have a get
p
then in this case it's going to be the
parent
and he's going to be a time frame whoop
dot objects.get equals parent id
i missed something oh okay that was just
a typo
and then i want to set the parent for
data
oops
to the parent
pretty straightforward uh we've probably
seen this before
we're just in other applications uh but
this is just sort of clean this stuff
up so now if we go to road maps and i go
here
so that's my annual goals i've got
overall annual goals i've got the first
quarter which if i edit it
he points back to the overall if i go
if i create a time frame here
and so first instead of seeing if it
just exists that way i have to see if
the index exists
so i'm actually going to use this i
think elsewhere
i need to do an n
let's see where else did i use that so
this is
if rm is in there
and that's probably it
yeah because i already did that in a
couple of these other places i just
did not do it correctly okay so fixing
that
save it let's go back here
let's refresh if i do an edit
uh everything's good if i do a create
let's actually inspect this real quick
because i'm not sure that's built right
uh so it's not building this so in child
time frames
let's go look at that in
edit time frame oh i don't think i saved
it
that may be the problem
so let's look at this again this time
i'm getting a p
parent equals a null
which is probably not right oh yes it is
uh so i go here and the problem is
is that parents should be equal to this
not
a null so i want to come in here
and uh it's actually form.id
which is not what i want actually i
think i just called that
did i call that id let's find out real
quick i may have actually sent that in
already
uh if i go to time frame edit
time frame id is that what that is yeah
so it's tfid
just to keep it simple
so i'm just passing it in that way and
now
i should see um my parent is one
uh because this is time frame one so if
i look here
parent equals one and so now if i do
create a time frame for
second quarter then i've got this i
don't have my roadmap yet
so i'm going to create this real quick i
am going to set it as the goals period
is going to be quarterly
and save the record and so now if i go
back to my roadmaps which i'm going to
want to be able to do this a little
differently but if i look at my overall
annual goals now i see first and second
quarter
now what i also want to do is be able to
set the roadmap
so it's going to be the same thing here
and i'm going to do ampersand rm equals
which i think i already used it yep
right here rmid
so i bet i may already have it set up
which would be good so if i go and
create
let's sit this way and do third quarter
goals
uh oh it's not oh
did it not i may not have set the value
right so let's go look at this again
let's look at this again uh let's see
so child time frames
oh that's create time frame which is
good yeah which is good
uh ampersand rmi rm equals
rmid
so maybe the roadmap's not coming
through right that may be the problem
yes i don't have
rmid passed into here for some reason
so let's see where i did
so there's rmid equals that that's with
edit a road map
oh that's easy enough to fix so if i
come into create
then uh let's see let's create time
frame time frame edit
uh yes oops
so let's edit i'm sorry there's edit
time frame
okay time frame so he probably wants to
send the same thing
actually
so if i send all of that in
well i really don't need all of that
so let's like let's get rid of that my
mistake
so let's go in here and we need to do we
do need um
am i not calling create time frame one
second while i'm looking at this i've
been doing tf
edit if i do tf with the create
let's make sure what i'm doing here uh
so if i do create time frame here
he's just doing a tf
so he should be hitting it at yes so
okay so i changed the wrong code i think
let's see
uh 299 and create frame so if we go here
299.
so it is in create oh no i'm good i'm
good except i'm not passing all that
stuff
in
so i'm building all this stuff out
well but i don't need children
but i do need
oh because i'm doing that a little bit
differently so i probably don't need all
of those so i can actually come in here
uh let's take a look at this real quick
pid rid
oh it's already an ant
so i don't need that i don't need that
let's keep this guy the same
as he was
let's see i think that'll work
let's try that it's probably something
undefined variable
task nope and roadmap good good good
id expected a number but got blank so
when i do the r i'm getting up oh my
road map's coming back
blank so if i go back here
oh i have to go all the way up i think
roadmap there
so he has roadmap id if i do create time
frame
he's not sending that in right so it
should be rm equals one
should sit there oh because i'm not
that's right when i come down here
so i have an rm but i need to have
uh what did i call that so we're gonna
come in here now
we set our roadmap id uh annual goals
got uh overall annual goals for to
create time frame
and now we have overall annual goals and
annual goals so we've set everything up
and we are off and running so
now we've got some of our basics the
next thing we want to do is we'll come
back around next time and
for our task we're going to go ahead and
pass down our time frame
but we've run out of time this time dug
through stuff a little bit next time
we're going to
quickly uh probably kind of swing
through that and we're going to clean up
a couple of things as well and then
continue moving forward so as always
you can check out the latest we are up
today this will be
tagged for day 35 and you can grab that
out of github take a look at the source
and as always go out there have yourself
a great day and we will talk to you
next time
you