📺 Develpreneur YouTube Episode

Video + transcript

Learn Python And Django Day 53

2021-04-29 •Youtube

Detailed Notes

We continue using the application as a way to track the tasks we have chosen for bug fixing and improving the user experience. This session is aimed at filtering tasks by timeframe on the fly for the view selector.

You can view source for today and all prior days by reviewing the tag Day 53 at this GitHub: https://github.com/robbroadhead/develpreneur-pythontutorial

Transcript Text
[Music]
hello and welcome back
we are continuing going through our uat
remediation kinds of stuff
and uh this episode we're just gonna
start now continue working through our
list
didn't want to note that i got my uh
style sheet updated
now you're actually seeing it in this
the uh from the past episode
and you can see that now we've slimmed
out our tasks that was one of our goals
we wanted to get knocked out
another thing i did not get
day 51 committed so if you look at day
52 and if you're following along
in github then you'll see a tag for day
52 which will have the changes from 51
and 52. now uh let's go ahead
and one of the things we want to do
whoops is here
on our home behind the scenes this is
working off of our current time frame
and this is this task we want to add a
filter essentially to our task list
i think that's the one that we want
and that looks good so
that'll be the one that we're going to
be focusing on next is we're going to
put a little filter here
now we've seen this before if we look at
our reports
basically if we go by timeline then we
have this select timeline so we're going
to steal that and we're going to put
that on to
over here on our to-do so if we take a
look
in uh that was in our reports
page
and what we did in that case is we
actually i think built that
on the fly so when we go into our views
we'll do essentially the same thing so
let's go to
reports page
ports generates tasks by
time frame
and then oh that was actually generating
it
report parameters here we go and we're
going to do
this one so we're going to select the
timeline
we're just going to steal that and we're
going to put that in the to do
where is oh to do
is actually though
if we look at to do it's active tasks
so let's go to active tasks there we go
and what we want to do
here is we're going to add
this will be before our parms
and this is going to be our we're going
to call this our
uh selector equals that
let's see options equals there oh let's
just take
that
that's selector equals selector plus
option option option farms equals
and we've got this changed up so now we
can send that across
and we're just going to call this now we
could do this actually
uh probably just as easily is that we
could actually
uh create this in our on our page
we're going to pass this in just because
um and actually what we probably should
end up doing is pull that
ideally this would get pulled out into
um
some sort of a little you know a method
of some sort i don't know if i want to
put it in the views so we're not going
to mess with it right now
but ideally what you do is is take this
uh this bit of code and just return
the string and you could probably do
that with a couple different things but
i don't want to chan i don't want to
change up my structure too much right
now so i'm just going to keep it
simple and so now i've got
going into task list i'm going to send a
selector
and i'm sure it has an id does it have
an id uh
yes so this is going to be
we're just going to call it uh tf
let's call it
uh id is just going to be tfid we'll
just call that
because then what we're going to end up
doing
is going to be able to do a little bit
of work on this so let's first do that
so let's add that to our selector which
is in our task list
which is in here somewhere there it is
oh yeah task list and then
let's take a look where we want to put
that we probably want to put it right
off
of create task actually we'll put it
before the count
uh that's a good question uh we'll go
ahead and put it
yeah let's put it before the count but
on the same line so we're going to do
we'll do something like this so this is
going to be a selector
and then if we do that and run it
whoops
so here what we want to do is
we actually want that to be
so let's go take a look at that that oh
that needs to be
which is uh this may be a problem
because the way we do it is
we were actually setting the inner html
based on that
so we don't really want to do it that
okay so we don't want to do it that way
my mistake
let's take that whole thing off and
instead this is going to be
um this is going to be options
which is going to be our time frames
uh let's just take that whole thing out
there and then this is going to be
so this is why you shouldn't do this
stuff necessarily on the fly but you get
to see a little bit of design
thought process as part of it so now
instead we're going to just pass the
options in
which is going to be our options for all
of our time frames uh
options options count okay so we should
be good so instead
uh where did that go that was task list
yes so instead
we're gonna do essentially the same
thing but here we're going to do
uh i'll keep that in there just because
i can't
and this is gonna be
for opt and ops
so we're going to actually be able to do
almost exactly the same code we did it's
going to be
uh n4
so like we did here and then
here instead we're just going to do
option
and then this is going to be the opt id
and then here is going to be
the opt name
and then let's see oh and then we need
the two we need to select
so we do that oh we don't need the four
anymore
so we've got our uh select id
equal to going to call this current
whoops current
time frame well i should spell select
right
and then we'll put the select after it
and then well we'll put that tasks count
and we'll do it like that so now let's
take a look
okay so now whoops it is not getting
that right
um
opt-in ops opt id
name
so must not be getting ops for oh
because i didn't save it uh
it helps to save all your changes
so we check it there we go so now we can
set a personal
we can set a time frame and so what
we've got to do though
is on that we're going to have to
actually recall
this page so what we need to do
is we're going to actually steal sort of
from our reports page i'm going to do
the same kind of
thing here um let me work it off select
[Music]
and i'm doing this mostly for speed
purposes just from a coding point of
view
as well so this is going to be select
time frame
and then i think what we want to do
here is we probably just want to
that's a good question okay so let's see
we want to first we got to grab
our select which is current tf
so current time frame we're going to get
that id
and then we're going to get its value
which is the id
and then we need to call
i think what we can do is we're going to
actually cheat this a little bit we're
going to create a new one that'll allow
us to set our time frame so we're going
to do
what do we call that go page
i don't like that thing at all let's see
go here
[Music]
uh here we go go page that's what we
called it
so what we can do is we can come in here
and we are going to do
this is going to be a set time frame
let's call it set uh let's call it that
and this is going to be id
with an id and i don't need anything
else
and so what set time frame is going to
do
so let's set tf
and we can just steal this so this is
going to be
set time frame and then it's going to do
a neat little thing here because it's
going to end up going back to the to-do
we're going to only do this here
so what we want to do is
uh we'll steal that one just because of
the signature whoops there we go we
still
set uh edit time frame
so we're gonna take edit time frame
basically take that we still need to be
that
yeah i don't know that we need too much
now
let's just let's copy and paste that
let's do set
time frame so we check for logged in
i don't know if we need that where did
we set
um i think
let's see did we just call it session tf
we called it
let's say p and oh because we've got it
here probably
it must be p
let's go back to our uh was that active
tasks
actually let's see where do we pull it
it was based off of time frame is
current where's current
oh it is p okay so
and it's just an id
so let's go here and so all we need to
do
here is do that request session equals
id and then we're going to do
a redirect
to to do
because we're just going to go ahead and
force that thing
to change now this is going to be a
little bit
uh hokey in a sense because oops let's
run report i don't want reports page
i want task list
and what i'm going to do is i'm going to
select time frame it's actually going to
be
uh on change i may be able to do
a where'd that go select
um oh that's going to be a good one i'm
going to go
do this i may want to try something a
little different so let's start with
this and see how it looks so if i do
select time frame
and then run it so now let's see
if i set it to march it's not doing
anything
okay so let's take a look at this uh
oop i don't want source i want to look
at
inspect console it's probably breaking
select time frame not okay it's not
defined so something's not right there
so select
oh with capital f okay got a match case
and actually we want to do probably is
set it to this so if i do that there we
go okay
yeah that's not too bad so i think we'll
leave it like this
what we could do is do something so
we're going to only
you know maybe do update button or on
change
like on leaving this field but let's
stick that for now and what i want to do
is
now i need to go into my views because i
need to do
uh where's that edit oh i'm sorry active
so now what i do need to do here is now
i'm gonna need to do
i'm gonna do a current
[Music]
and current is equal to that okay so i
do have current
there oh i want it to be
i don't want to do that well okay so i
do have a pid here so let's do that
equals zero
and then otherwise pid equals that
and so i'm going to do it this way so
what i'm going to be able to do
is say
now i get to go to my task list and when
i'm building this thing out
i'm going to do a little if here so it's
going to be
selected equals
selected
but i'm going to wrap that with a little
if
so i'll actually do it this way just so
it's a little easier to read
oh and i need that selected equals
that's be a string
and i'm going to do a percent
and if
and this is going to be uh if dot
id equals pid
and that probably will work did i have
an end if oh i want to do end if this
way
so now let's take a look
so immediate is going to come back oh
there it is so it's going to complain
because oh it's got to be equals equals
uh where did i put that
but that's what i need there we go
so now if i go to my roadmaps and i
select something different from
immediate
so my current time frame now is probably
uh
is professional goals if i go to roadmap
whoop i'm sorry if i go here
professional goals there we go so now i
can do that i can change stuff out
and i've completed my task so it took a
little bit
but i'm going to go ahead and make this
just our sort of our focus right now is
filtering our results
and we'll wrap this episode up and we'll
come back next time and continue working
our way through our list
as always go out there and have yourself
a great day and we will talk to you
next time
you
Transcript Segments
0.93

[Music]

26.32

hello and welcome back

27.84

we are continuing going through our uat

31.039

remediation kinds of stuff

33.44

and uh this episode we're just gonna

35.12

start now continue working through our

36.8

list

37.76

didn't want to note that i got my uh

39.92

style sheet updated

41.44

now you're actually seeing it in this

43.12

the uh from the past episode

45.6

and you can see that now we've slimmed

47.28

out our tasks that was one of our goals

48.879

we wanted to get knocked out

51.12

another thing i did not get

54.16

day 51 committed so if you look at day

57.039

52 and if you're following along

59.359

in github then you'll see a tag for day

61.92

52 which will have the changes from 51

64.479

and 52. now uh let's go ahead

68.88

and one of the things we want to do

70.64

whoops is here

72.4

on our home behind the scenes this is

75.6

working off of our current time frame

77.92

and this is this task we want to add a

81.68

filter essentially to our task list

85.119

i think that's the one that we want

89.119

and that looks good so

92.32

that'll be the one that we're going to

93.28

be focusing on next is we're going to

94.799

put a little filter here

96

now we've seen this before if we look at

98.96

our reports

102

basically if we go by timeline then we

105.2

have this select timeline so we're going

106.56

to steal that and we're going to put

108.159

that on to

109.84

over here on our to-do so if we take a

112.88

look

113.439

in uh that was in our reports

117.6

page

120.799

and what we did in that case is we

122.32

actually i think built that

123.92

on the fly so when we go into our views

126.64

we'll do essentially the same thing so

127.92

let's go to

129.84

reports page

133.599

ports generates tasks by

136.879

time frame

140.16

and then oh that was actually generating

142.4

it

143.92

report parameters here we go and we're

146.56

going to do

148.8

this one so we're going to select the

150.48

timeline

152

we're just going to steal that and we're

154.08

going to put that in the to do

160.72

where is oh to do

163.76

is actually though

166.879

if we look at to do it's active tasks

172

so let's go to active tasks there we go

174.72

and what we want to do

176

here is we're going to add

180.08

this will be before our parms

186.64

and this is going to be our we're going

188.72

to call this our

190

uh selector equals that

194.319

let's see options equals there oh let's

197.519

just take

199.519

that

203.599

that's selector equals selector plus

209.12

option option option farms equals

215.92

and we've got this changed up so now we

218.08

can send that across

221.12

and we're just going to call this now we

222.879

could do this actually

225.44

uh probably just as easily is that we

228.72

could actually

230

uh create this in our on our page

233.76

we're going to pass this in just because

237.04

um and actually what we probably should

238.56

end up doing is pull that

240.48

ideally this would get pulled out into

243.439

um

244.4

some sort of a little you know a method

247.36

of some sort i don't know if i want to

248.72

put it in the views so we're not going

249.84

to mess with it right now

251.92

but ideally what you do is is take this

255.439

uh this bit of code and just return

258.56

the string and you could probably do

259.919

that with a couple different things but

262.4

i don't want to chan i don't want to

263.84

change up my structure too much right

265.44

now so i'm just going to keep it

266.88

simple and so now i've got

270.16

going into task list i'm going to send a

272.639

selector

276.08

and i'm sure it has an id does it have

278.24

an id uh

280

yes so this is going to be

283.12

we're just going to call it uh tf

286.96

let's call it

290

uh id is just going to be tfid we'll

292

just call that

293.52

because then what we're going to end up

295.12

doing

296.96

is going to be able to do a little bit

298.4

of work on this so let's first do that

300.479

so let's add that to our selector which

302.56

is in our task list

306.16

which is in here somewhere there it is

307.84

oh yeah task list and then

310.72

let's take a look where we want to put

312

that we probably want to put it right

313.36

off

313.759

of create task actually we'll put it

316.479

before the count

319.68

uh that's a good question uh we'll go

322.4

ahead and put it

325.36

yeah let's put it before the count but

328.08

on the same line so we're going to do

331.12

we'll do something like this so this is

332.639

going to be a selector

336.16

and then if we do that and run it

340.24

whoops

346

so here what we want to do is

349.36

we actually want that to be

356.24

so let's go take a look at that that oh

358.56

that needs to be

360.319

which is uh this may be a problem

362.4

because the way we do it is

366.24

we were actually setting the inner html

369.52

based on that

372.56

so we don't really want to do it that

373.919

okay so we don't want to do it that way

375.36

my mistake

376.16

let's take that whole thing off and

379.12

instead this is going to be

380.72

um this is going to be options

385.12

which is going to be our time frames

388.72

uh let's just take that whole thing out

390.319

there and then this is going to be

395.6

so this is why you shouldn't do this

397.12

stuff necessarily on the fly but you get

398.8

to see a little bit of design

400.16

thought process as part of it so now

401.759

instead we're going to just pass the

403.039

options in

404.16

which is going to be our options for all

405.759

of our time frames uh

408.16

options options count okay so we should

411.599

be good so instead

413.44

uh where did that go that was task list

417.199

yes so instead

421.68

we're gonna do essentially the same

422.96

thing but here we're going to do

425.44

uh i'll keep that in there just because

427.44

i can't

430.639

and this is gonna be

434

for opt and ops

437.36

so we're going to actually be able to do

438.639

almost exactly the same code we did it's

440.56

going to be

441.28

uh n4

445.599

so like we did here and then

448.96

here instead we're just going to do

451.199

option

454.16

and then this is going to be the opt id

463.919

and then here is going to be

468

the opt name

476

and then let's see oh and then we need

478.24

the two we need to select

480.8

so we do that oh we don't need the four

483.12

anymore

486.16

so we've got our uh select id

489.599

equal to going to call this current

493.36

whoops current

496.4

time frame well i should spell select

500.08

right

503.52

and then we'll put the select after it

506.96

and then well we'll put that tasks count

511.52

and we'll do it like that so now let's

513.2

take a look

515.76

okay so now whoops it is not getting

519.279

that right

520.399

um

524.24

opt-in ops opt id

527.839

name

532.72

so must not be getting ops for oh

534.32

because i didn't save it uh

535.92

it helps to save all your changes

539.44

so we check it there we go so now we can

541.279

set a personal

542.64

we can set a time frame and so what

544.24

we've got to do though

545.76

is on that we're going to have to

548.72

actually recall

550.72

this page so what we need to do

554.64

is we're going to actually steal sort of

556.24

from our reports page i'm going to do

557.76

the same kind of

558.72

thing here um let me work it off select

566.21

[Music]

568

and i'm doing this mostly for speed

570.72

purposes just from a coding point of

572.48

view

572.8

as well so this is going to be select

574.08

time frame

578.8

and then i think what we want to do

581.839

here is we probably just want to

586.16

that's a good question okay so let's see

587.68

we want to first we got to grab

590.08

our select which is current tf

594.48

so current time frame we're going to get

596.08

that id

599.2

and then we're going to get its value

601.6

which is the id

604

and then we need to call

608.079

i think what we can do is we're going to

609.44

actually cheat this a little bit we're

611.12

going to create a new one that'll allow

612.399

us to set our time frame so we're going

613.92

to do

615.2

what do we call that go page

622.16

i don't like that thing at all let's see

623.92

go here

624.76

[Music]

625.839

uh here we go go page that's what we

628.72

called it

629.839

so what we can do is we can come in here

631.44

and we are going to do

634.56

this is going to be a set time frame

641.12

let's call it set uh let's call it that

644.959

and this is going to be id

653.519

with an id and i don't need anything

655.36

else

659.04

and so what set time frame is going to

660.959

do

663.12

so let's set tf

668.8

and we can just steal this so this is

670.64

going to be

672.959

set time frame and then it's going to do

677.04

a neat little thing here because it's

678.399

going to end up going back to the to-do

680.32

we're going to only do this here

682.399

so what we want to do is

685.76

uh we'll steal that one just because of

687.68

the signature whoops there we go we

689.68

still

690.24

set uh edit time frame

695.519

so we're gonna take edit time frame

699.04

basically take that we still need to be

701.92

that

702.64

yeah i don't know that we need too much

704.56

now

708.48

let's just let's copy and paste that

712.399

let's do set

713.2

time frame so we check for logged in

717.839

i don't know if we need that where did

719.36

we set

723.68

um i think

727.44

let's see did we just call it session tf

732.72

we called it

739.68

let's say p and oh because we've got it

742.959

here probably

749.04

it must be p

754.079

let's go back to our uh was that active

756.56

tasks

757.6

actually let's see where do we pull it

759.12

it was based off of time frame is

761.6

current where's current

763.44

oh it is p okay so

767.2

and it's just an id

770.32

so let's go here and so all we need to

773.44

do

773.76

here is do that request session equals

777.36

id and then we're going to do

780.399

a redirect

784.8

to to do

788.959

because we're just going to go ahead and

790.56

force that thing

792.079

to change now this is going to be a

794.16

little bit

795.36

uh hokey in a sense because oops let's

798.48

run report i don't want reports page

800.16

i want task list

803.519

and what i'm going to do is i'm going to

804.639

select time frame it's actually going to

806.639

be

808

uh on change i may be able to do

811.68

a where'd that go select

817.44

um oh that's going to be a good one i'm

820.16

going to go

820.639

do this i may want to try something a

822

little different so let's start with

823.36

this and see how it looks so if i do

826.16

select time frame

832

and then run it so now let's see

836

if i set it to march it's not doing

838.88

anything

839.92

okay so let's take a look at this uh

844

oop i don't want source i want to look

846.8

at

847.36

inspect console it's probably breaking

855.199

select time frame not okay it's not

857.04

defined so something's not right there

858.639

so select

859.519

oh with capital f okay got a match case

866.399

and actually we want to do probably is

867.839

set it to this so if i do that there we

869.68

go okay

871.279

yeah that's not too bad so i think we'll

874.8

leave it like this

876.32

what we could do is do something so

878.72

we're going to only

879.76

you know maybe do update button or on

882.24

change

883.44

like on leaving this field but let's

886.959

stick that for now and what i want to do

889.839

is

892.8

now i need to go into my views because i

894.72

need to do

897.36

uh where's that edit oh i'm sorry active

902.48

so now what i do need to do here is now

905.6

i'm gonna need to do

909.36

i'm gonna do a current

914.14

[Music]

915.44

and current is equal to that okay so i

917.36

do have current

920.72

there oh i want it to be

926.48

i don't want to do that well okay so i

928.399

do have a pid here so let's do that

935.36

equals zero

939.199

and then otherwise pid equals that

943.36

and so i'm going to do it this way so

946.16

what i'm going to be able to do

947.279

is say

950.399

now i get to go to my task list and when

953.36

i'm building this thing out

958.639

i'm going to do a little if here so it's

961.279

going to be

961.759

selected equals

966.839

selected

968.639

but i'm going to wrap that with a little

970.32

if

976.32

so i'll actually do it this way just so

977.759

it's a little easier to read

980.24

oh and i need that selected equals

982.24

that's be a string

985.68

and i'm going to do a percent

989.44

and if

993.92

and this is going to be uh if dot

997.279

id equals pid

1004.24

and that probably will work did i have

1007.6

an end if oh i want to do end if this

1009.36

way

1012.959

so now let's take a look

1016.72

so immediate is going to come back oh

1018.16

there it is so it's going to complain

1020

because oh it's got to be equals equals

1025.36

uh where did i put that

1029.28

but that's what i need there we go

1033.839

so now if i go to my roadmaps and i

1036

select something different from

1037.199

immediate

1038.079

so my current time frame now is probably

1040.88

uh

1041.439

is professional goals if i go to roadmap

1043.919

whoop i'm sorry if i go here

1045.839

professional goals there we go so now i

1048.079

can do that i can change stuff out

1050.32

and i've completed my task so it took a

1053.44

little bit

1054

but i'm going to go ahead and make this

1056.32

just our sort of our focus right now is

1058.48

filtering our results

1060.48

and we'll wrap this episode up and we'll

1063.2

come back next time and continue working

1064.72

our way through our list

1066.48

as always go out there and have yourself

1068

a great day and we will talk to you

1071.12

next time

1088.08

you