Detailed Notes
Part III of the creation of reports. We move into displaying results and a result template.
You can view source for today and all prior days by reviewing the tag Day 46 at this GitHub: https://github.com/robbroadhead/develpreneur-pythontutorial
Transcript Text
[Music] hello and welcome back we're continuing looking at our django python series of our application and we are deep into reports so we're going to continue this time last time around we set it up so we're able to basically dynamically create our parameters and so what we're going to do this time around is we're going to actually run a report now there's a couple ways we can do this we could create a url for each report and we could actually from run report basically you know turn around and display some some results at this point we're going to do a little differently so what i want to do instead because i want to keep it moderately flexible so i'm going to do actually i'm just going to keep it very simple so i'm going to do rpt and then i'm going to give it an id and um that's a good question how do i want to do that i think what i want to do here is i'm going to give it an id and since for this one these are all simple i'm going to give it a parameter and so that parameter is going to be also let's make that a string because each of these is well let's see let's look at this real quick because we can do a couple different ways now what we could do is we could post it and have it try to grab the parameters which is probably it's really it's the best way to go about this as far as being able to uh do things but let's just do it by id so whatever we have here we're gonna have this parameters have an id and then we'll use that to get to what we want so we're going to have an id for the report let's actually call that report id and then we're going to have a pid which is going to be the parameter now this does limit us because we're only going to be able to send one parameter value per report but for now we're going to keep it simple so let's do just report generate instead of reports page and now that means we've got to go over to our views and reports page we'll just record copy that for now and he's going to have the report id and the parameter id and he's called report generate and now he's gonna have uh some sort of his title is gonna be based on the uh type that we get and so we've got three where do we put those so let's just sort of take this right now and move this to report generate and so if i can do it like this so for right now uh title equals task by timeline test by roadmap and test by status now we're going to use this reports page so we're actually going to be able to basically come back to although it's a slightly different url we're still going to be able to you know dynamically make some changes go in we can look at a report and quickly pull another now one other thing we want to do is let's go back to uh let's clear a couple of these guys out and jump to reports page now what we have here okay so we do have tasks and then it's going to list out tasks based on what we have uh let's say we're going to change this taskless report method ty report criteria so it's going to tell us if we don't have any tasks then so be it now let's actually do now so that's our oops this is going to be our report id and what we're going to do in each of these actually is tasks which we have to send so we're going to do tasks and that's going to be tasks and each of that one is going to be uh based on we have that somewhere so let's do let's do it like this and steal that so let's see test equals that so let's just do this real quick and so for each of these what we're going to do is we're going to filter it based on something so this one is going to be the timeline which i think we call it that so we have timeline roadmap and status and if we look at our tasks that means we have oh time frame we have status and then road map's going to be actually up a level so that's going to be a little different so we're going to do a time frame and that's going to be equals tf and we're going to get that and our tf is going to be equal to time line dot objects dot get where the pk equals our id so we're going to filter for that and so let's actually take the same way road maps can be a little different so we're going to do that one boy how do we want to do that we'll not deal with that yet we're going to do that a little bit funky so we're going to come back to that so first let's see status equals lookup status dot objects.get so there we go and this one's going to be the status equals status let's let's call it st just to avoid some confusion oh do we not have oh i'm sorry it is time frame i don't know why i keep wanting to call it timeline but that's by time frame let's do it that way uh and then this one oh it's not timeline oh uh time frame equals that time frame so that's the same thing we're gonna fix this one on minute first let's get these two done so now we're going to do status and we're going to do by time frame so if we take those oh and then run report needs to actually call that so run report is going to call whoops in my url it's going to call this guy so we need to go to our reports page and we do select report let's see where did we do run report run report run report does run report so we don't have him yet so let's create him and it's going to do this and let's go look at what we did with some of these others so we're gonna be able to pick up our go page and we're gonna use that here except for what it's going to be is it's going to be the report whoops with that plus our id plus and then we're going to do the report id so we're going to call that but first we have to get those values and those are going to come from so we've got the report and call it the perimeter i'll call it parm and so the report is based off of the report selector and our parms whoops let's go here i think those were based off of we called those look here that was report parm1 so rpt capital p parm whoops arm one and then actually this is going to be supposed to be report.value and parm.value and let's see if this works so if we do go page there that should be good if we look here what we did a go page in the past it's just because it's included so we should be set uh let's see so that should be all good and it's going to say it can't find that oh so i could do that global go page so let's do that just to make it like that there we go okay so it's going to run a report and let's see how that works so if we come in here and we do this so let's do we can do by status and let's do everything that's complete let's see what happens when we do run okay so run report undefined complete we are it's grabbing the wrong value so let's take a look at that again so if we look at our views uh that's staff my status blah blah blah blah blah so here we go so should be each of those should be the option id let's take a look at that so if we look back oh so we probably don't want value we actually want an id within that so let's look at that real quick so if we look here let's look at our page so we do this okay so text by stat oops let's do this and if we do that and that's equal to complete and we look look here so that's the id oh that's the id i'm sorry those want to be values by mistake so there's a little bit of a mistake we made there so this actually wants to be value value and oh no i want that to be the id but when i create the options i want those to be the values so let's change that up a little bit um and then that means i probably want to fix that in my report itself uh where did i put that nope i've got those values okay so that should be so report type oh the select is report type my mistake i did that again so that's let's fix that uh get my id and now let's take a look at this guy so come in let's do it by status complete run report three three and so now it's giving us our list now our list is a little bit uh interesting and how it's pulling stuff out because of how we do this so we'll take a look at that let's take a look at our report real quick and so for each of these we've got a time frame blah blah blah blah we got each of those we've got a div and so that's going to go page let's make him a row and see if that works see if that cleans that up just a little bit okay not exactly how we wanted to do it so let's tweak that let's go back to where we were and since each of these is a car oh because we changed the way we did these guys a little bit ago right so we've got these and we've got we're missing a div somewhere in here i think what we'll see so let's uh let's not worry about that yet so if we go by timeline up let's see let's do that so that was by there if we go by timeline and we pick everything that is first quarter then we're going to only get the things that are in that time frame so we have those two so let's uh wrap this up a little bit next time what we're going to do is we'll come around and we're going to fix this the status stuff and we are also going to handle our road map which is a little more complex so that'll wrap it up this time we'll come back and wrap up reports so go out there until the next time have yourself a great day a great week and we will talk to you next time you
Transcript Segments
[Music]
hello and welcome back
we're continuing looking at our django
python series
of our application and we
are deep into reports so we're going to
continue this time
last time around we set it up so we're
able to
basically dynamically create our
parameters
and so what we're going to do this time
around is we're going to actually
run a report now there's a couple ways
we can do this
we could create a url
for each report and we could actually
from run report basically you know turn
around and display some
some results at this point
we're going to do a little differently
so what i want to do instead
because i want to keep it moderately
flexible
so i'm going to do actually i'm just
going to keep it very simple so i'm
going to do rpt
and then i'm going to give it an id
and um
that's a good question how do i want to
do that i think what i want to do here
is i'm going to give it an id
and since for this one these are all
simple
i'm going to give it a parameter
and so that parameter is going to be
also
let's make that a string because each of
these
is well let's see let's look at this
real quick because we can do a couple
different ways
now what we could do is we could post it
and have it try to grab the parameters
which is probably it's really it's the
best way to go about this
as far as being able to uh do things but
let's just do it by
id so whatever we have here
we're gonna have this parameters have an
id and then we'll use that
to get to what we want so we're going to
have an id
for the report let's actually call that
report id
and then we're going to have a pid which
is going to be the parameter
now this does limit us because we're
only going to be able to send
one parameter value per report but for
now we're going to keep it simple
so let's do just report generate
instead of reports page and now that
means we've got to go over to our views
and reports page
we'll just record copy that for now and
he's going to have
the report id and the parameter id
and he's called report generate and now
he's gonna have uh some sort of
his title is gonna be based on
the uh type that we get and so we've got
three
where do we put those so let's just sort
of take this right now
and move this to report generate and so
if
i can do it like this
so for right now uh
title equals
task by timeline
test by roadmap
and test by status
now we're going to use this reports page
so we're actually going to be able to
basically come back to although it's a
slightly different url we're still going
to be able to
you know dynamically make some changes
go in we can look at a report and
quickly
pull another now one other thing we want
to do is let's go back to
uh let's clear a couple of these guys
out and jump to reports page
now what we have here okay so we do have
tasks
and then it's going to list out tasks
based on what we have
uh let's say
we're going to change this
taskless report method ty report
criteria
so it's going to tell us if we don't
have any tasks then so be it now let's
actually do now so
that's our oops this is going to be our
report id
and what we're going to do in each of
these actually is
tasks which we have to send
so we're going to do tasks
and that's going to be tasks and each of
that one
is going to be uh based
on
we have that somewhere so let's do
let's do it like this and steal that
so let's see test equals that
so let's just do this real quick and so
for each of these what we're going to do
is we're going to
filter it based on something so this one
is going to be the timeline which i
think we call it that so we have
timeline roadmap and status
and if we look at our tasks that means
we have oh time
frame we have status
and then road map's going to be actually
up a level so that's going to be a
little different so we're going to do
a time frame
and that's going to be equals tf and
we're going to get that
and our tf is going to be equal to time
line dot objects
dot get where the pk equals
our id
so we're going to filter for that and so
let's actually take the same way
road maps can be a little different so
we're going to do that one
boy how do we want to do that we'll not
deal with that yet
we're going to do that a little bit
funky so we're going to come back to
that so first
let's see status equals
lookup status
dot objects.get so there we go and this
one's going to be the status equals
status
let's let's call it st just to avoid
some confusion
oh do we not have oh i'm sorry it is
time frame
i don't know why i keep wanting to call
it timeline but that's by time frame
let's do it that way
uh and then this one oh it's not
timeline
oh uh time frame equals that time
frame so that's the same thing we're
gonna fix this one on minute first
let's get these two
done so now we're going to do status and
we're going to do
by time frame so if we take those
oh and then run report needs to actually
call that
so run report is going to call
whoops in my url it's going to call this
guy
so we need to go to our reports page
and we do select report let's see where
did we do run report run report run
report does run report so
we don't have him yet so let's create
him
and it's going to do
this and let's go look at what we did
with some of these others
so we're gonna be able to pick up our go
page
and we're gonna use that here except for
what it's going to be
is it's going to be the report whoops
with that plus
our id plus
and then we're going to do the report id
so we're going to call that but first we
have to get those values and those are
going to come
from
so we've got the report and
call it the perimeter i'll call it parm
and so the report is based off of
the report selector
and our parms whoops let's go here i
think those were based off of we called
those
look here that was report parm1
so rpt
capital p parm whoops arm one
and then actually this is going to be
supposed to be report.value
and parm.value
and let's see if this works so if we do
go page
there that should be good if we look
here what we did a go page in the past
it's just because it's included so we
should be set
uh let's see so that should be all good
and it's going to say it can't find that
oh so i could do that global go page so
let's do that just to make it
like that there we go okay
so it's going to run a report and let's
see how that works
so if we come in here and we do this so
let's do we can do by status
and let's do everything that's complete
let's see what happens when we do run
okay so run report undefined complete
we are
it's grabbing the wrong value so let's
take a look at that again so if we look
at our views
uh that's staff my status blah blah blah
blah blah so here we go so
should be each of those should be the
option id
let's take a look at that so if we look
back
oh so we probably don't want value we
actually want
an id
within that so let's look at that real
quick so if we look here
let's look at our page so we do
this okay so text by stat
oops let's do this
and if we do that and that's equal to
complete
and we look
look here
so that's the id
oh that's the id i'm sorry those want to
be values
by mistake so there's a little bit of a
mistake we made there so this
actually wants to be value
value and oh
no i want that to be the id but when i
create the
options i want those to be the values
so let's change that up a little bit um
and then that means i probably want to
fix
that in my report itself
uh where did i put that nope i've got
those values okay so that should be so
report
type oh the select is report type my
mistake i did that again
so that's let's fix that
uh get my id and now let's take a look
at this guy
so come in let's do it by status
complete
run report three three and so now it's
giving us our list
now our list is a little bit uh
interesting and how it's pulling stuff
out
because of how we do this
so we'll take a look at that let's take
a look at our report
real quick
and so for each of these we've got a
time frame
blah blah blah blah we got each of those
we've got a div
and
so that's going to go page let's make
him a row
and see if that works
see if that cleans that up just a little
bit
okay not exactly how we wanted to do it
so let's
tweak that let's go back to where we
were
and since each of these is a car oh
because we
changed the way we did these guys a
little bit ago right
so we've got these and we've got we're
missing a div somewhere in here i think
what we'll see so
let's uh let's not worry about that yet
so if we go by timeline
up let's see let's do that so that was
by there if we go by timeline and we
pick everything that is
first quarter then we're going to only
get the things that are in that time
frame
so we have those two so let's uh wrap
this up a little bit next time what
we're going to do is we'll come around
and we're going to fix
this the status stuff and
we are also going to handle our road map
which is a little more complex
so that'll wrap it up this time we'll
come back and wrap up reports
so go out there until the next time have
yourself a great day
a great week and we will talk to you
next time
you