📺 Develpreneur YouTube Episode

Video + transcript

Learn Python And Django Day 42

2021-03-23 •Youtube

Detailed Notes

This tutorial goes into some debugging steps and moving the UX form buttons to some clickable DIVs.

You can view source for today and all prior days by reviewing the tag Day 43 at this GitHub (this one includes day 42 as well): https://github.com/robbroadhead/develpreneur-pythontutorial

Transcript Text
[Music]
well hello and welcome back
we are going to continue we're
continuing our django in python
application and we're doing a little bit
of uh some updates and things like that
we're going to
catch a little bugs and clean a few
things out right now
so first thing we want to do is let's
get rid of this edit button on our road
maps
and we're gonna do this a couple places
so that when we click on a card
we're gonna go right to edit so if we
look up here
in our roadmaps
if we go to our views
and we go to road maps
which is in our list somewhere in there
there we go list road maps so in our
roadmap
list
this is going to be actually fairly
simple what we're going to do is we're
going to take this button on click edit
and all we're going to do is move our on
click
up to the div
and then we can remove our button
i'm going to do this a couple places and
it's going to just simplify
our whoops i don't need that i do need
that and so now
when i refresh it if i'm going to go to
annual goals 2021
click on it and that's going to get here
so we're going to do this here
at our uh this is our roadmap detail
we're going to do the same thing
so that's our roadmap edit again
we're gonna move a few of these things
around
and get rid of these buttons
like that and if we look here now
see here and now we're going to do it in
our time frame so we're going to do the
same whoops
go here
so if i do a time frame edit
so you see this is actually fairly
easy to do and it just cleans up the
interface a little bit as if we move
these clicks that we've gone through now
the button is nice
initially uh particularly while we're
designing things so we can go through
and we can
look at it and say yes this needs to be
this is something that makes sense
from a navigation point of view
to have a button or from a click so now
look we're cleaning this stuff up pretty
quick oops i moved the wrong button down
there
at the bottom so that was actually the
complete i don't want the complete
i want the
oh i just want this just this event
and then get rid of that button
and then this would be a case sometimes
that you would need you'd maybe want to
have multiple buttons or
actions or links or something like that
because of the complete option
but this sort of you know sort of nice
there so let's actually take that
and if we go up to our road maps
let's see actually let's look at our
tasks see how we've got this set up
let's do this
in our as we get down to
our what is that that's our goals let's
clean that up so that
it gets done a little bit better and
we're going to get rid of this whole
thing here we've we don't have any space
at the bottom
we didn't build that out right so i'm
going to cheat it a little bit
uh let's see so this is going to be
is that time frame it's time frame edit
so the first thing i want to do is i'm
going to clean this up a little bit so
let's take
ah that doesn't look too bad all we're
going to do
is now we're going to split this into
two divs
so the first one actually we can do it
from here because we're going to move
the buttons going to be in a different
div
and we're going to use that spacing much
as we did on the
task list so let's take a look at how do
we split that
out let's see so it was a button task
which we may keep at that let's change
that but that class over
so we'll go over here and he's going to
be
instead of a button info he's going to
be button task
and let's go back to that guy we had him
split but
we had them split actually a couple
places we had these remember we do this
by 12
there's 12 divisions across the
bootstrap so we've got 3 4 which is 7
plus 2 is 9 and 3 is 12. so what we're
going to do is we're just going to go
ahead
and do just two of these this time
and let's see how that looks so if we do
oops and that's in the let me just pull
the
that's all i need because i've already
got a class for both of those
divs so his class is tasks and he's
going to be an
md9 and this one oh he doesn't need one
so it's going to be
an md3 and let's take a look at how that
looks
so we go here and we see oops i did not
put
i want him inside the div so
whoops so i need to have my overall card
which i'm going to click on to edit and
then within it
i'm going to have two divs so i'm going
to change this up a little bit because
this is going to be now
so i'm going to have a div oops here
oops i just duplicated that on me
oops okay i did not paste that right so
let's do it this way so i'm going to
take that
and so i've got a name and status it's
going to be a dive
and he's going to be an md9 while the
other one's going to be within there and
he's going to be an md3
and if we look there we go so now he's
but he's on a different page
so let's oh so we got to wrap those as a
row
i'll do the whole thing can i have a div
row somewhere i
do not have one so i'm just going to
grab one more of those
so now
i'm going to combine those guys
like that
and we should be able to say well there
we go so now we've got our completes
down here and if we click on them we can
edit it
but let's get some space down there
and i'm going to do it in the most
blatant easy way to do it at this point
is i'm just going to throw some
breaks in there we'll come back to this
another time
and probably play around with that a
little bit but for now let's just open
that up a little bit
and so now actually i'm just going to
give myself a little bit of space here
so as i scroll down i've got some space
at the bottom i could
open that up or close that up a little
bit more if i wanted but for now
we're going to keep it that way so we
come in
let's start with road maps we click here
we can look at the children
and we can look at a given time frame
so i think we're good because we've got
our goals
we've got here if we edit nothing there
turn annual personal goals annual goals
and so uh what we oh and then we
have here we can go back up we didn't
actually keep our little button here
because we can just get room app to get
back
uh there's two of these actually now
because we've got
we're in home or task list
then oops first let's get these so if i
click on it we're gonna get rid of the
edits for
the to do and the tasks
which is probably both going to be a
task list
i think this will cover both of them so
let's see for the edit we're going to
get rid of that
and we'll actually do it all the way up
at the card level
whoop is that how i want to do it yes so
for each task i'm going to click on it
there and so now i can get rid of edit
and i don't need the break
so if i save it i got rid of that
and i'm getting a matching query does
not exist which will be
interesting uh let's see we are blowing
up in views it's going
uh line 127 oh the parent
it's probably because that does not
exist so if it has no parent then we're
probably blowing up so let's take a look
at that
if we go look at that guy
we will see that uh owner
oh that's not owner i don't have parent
mi task
so i did not add that in there for some
reason parent attachment time cement
owner let's go take a look at that
so if i go back in my look at my model
real quick to edit
edit task
and i think it gave me that at line 127.
so line 127.
so oh it's the time frame objects get
so if there's a p is in the
request.session
so that means if there's a parent then
he's going to try to get that one
and so let's just do this real quick
and let's see what it's spitting out for
us
if we rebuild that whoops
did it die on me where here we go
oh i need my parentheses there
so i need to go back to my view
my mistake
and so we're probably going to need to
do is clean this stuff out oh which we
do need to do because that
is that's our problem is when we do a
let's see so what we need to do is we
need to unset
our session when we do
a list because as we come into whoops
uh is it gonna let's see can i show it
to me
yeah so if i go into my list so here we
don't have
remember we set our roadmap and time
uh time period that we're setting those
because we had that context well we
don't have that context anymore
so what we need to do is we need to do a
clean session
and we're just going to call that when
we do list tasks so here
he needs to do i think you can do
request.clean
session
so
actually i don't think we to do it i
think we need to do it like this let's
sit this way
there because it's not a self my mistake
so if we do clean session now
what it's going to do is it still
getting it oh it says it is so let's
make sure
that we clean out our session properly
so now
oops it's probably because i'm not
cleaning the right one so let's do this
one so that's list tasks
oh and this is going to be the list
tasks with
oh that's edit tasks
oops so we have to do it here
i'm still getting it so let's take a
look at that so tasks
is calling
uh tasks is calling list tasks
so list tasks calls clean session
and so let's just do this
well actually what i need to do is uh
if he's in the session and
not equal to null i'm sorry not equal to
none
because that's what's going to happen as
it's coming through
oh and that's some and
so what's it complaining about one
second here
there we go i think that's gonna work
there we go so now we don't have uh and
so now this return to annual goals
is going to blow up because it doesn't
really have um
i don't think we have the right yeah
we're setting this incorrectly so if we
go into the edit task
let's see here uh parent equals parent
otherwise it equals none
so if we look here where it's just going
to be on
um edit task
well actually as i'm looking at the
clock we're running out of time so i'm
going to actually fix this next time
around but what we did do
this time around is we're clicking on
our stuff now to edit as opposed to
these
edit buttons everywhere i think that'll
take care of
all of our edits and we have to deal
with the
side effects of setting stuff up in the
session which is
part of the reason that it was it's
cleaner when you pass it
um but it's also sort of nice to
you know from a convenience point of
view to keep track of those sessions
and keeps track of stuff within the
session so we're going to clean that up
next time but for now we'll wrap it up
so go out there have yourself a great
day a great week and we will talk to you
next time
you
Transcript Segments
0.62

[Music]

26.16

well hello and welcome back

28.08

we are going to continue we're

29.519

continuing our django in python

31.439

application and we're doing a little bit

33.68

of uh some updates and things like that

35.68

we're going to

36.239

catch a little bugs and clean a few

38.32

things out right now

40.239

so first thing we want to do is let's

41.84

get rid of this edit button on our road

44.719

maps

45.2

and we're gonna do this a couple places

46.399

so that when we click on a card

48.399

we're gonna go right to edit so if we

50.719

look up here

51.52

in our roadmaps

55.36

if we go to our views

59.12

and we go to road maps

63.44

which is in our list somewhere in there

67.68

there we go list road maps so in our

70.64

roadmap

71.36

list

74.64

this is going to be actually fairly

75.84

simple what we're going to do is we're

77.119

going to take this button on click edit

80.08

and all we're going to do is move our on

81.759

click

84.159

up to the div

88.96

and then we can remove our button

93.759

i'm going to do this a couple places and

95.28

it's going to just simplify

96.88

our whoops i don't need that i do need

99.119

that and so now

101.6

when i refresh it if i'm going to go to

103.6

annual goals 2021

105.2

click on it and that's going to get here

107.2

so we're going to do this here

108.56

at our uh this is our roadmap detail

111.92

we're going to do the same thing

114.56

so that's our roadmap edit again

119.2

we're gonna move a few of these things

120.96

around

124.88

and get rid of these buttons

129.599

like that and if we look here now

134.08

see here and now we're going to do it in

136.959

our time frame so we're going to do the

138.56

same whoops

139.76

go here

144.16

so if i do a time frame edit

150.4

so you see this is actually fairly

153.44

easy to do and it just cleans up the

157.12

interface a little bit as if we move

158.8

these clicks that we've gone through now

160.4

the button is nice

161.36

initially uh particularly while we're

164

designing things so we can go through

165.599

and we can

166.48

look at it and say yes this needs to be

168.959

this is something that makes sense

170.72

from a navigation point of view

174

to have a button or from a click so now

177.2

look we're cleaning this stuff up pretty

178.56

quick oops i moved the wrong button down

180.239

there

180.56

at the bottom so that was actually the

183.44

complete i don't want the complete

187.92

i want the

191.599

oh i just want this just this event

197.36

and then get rid of that button

201.519

and then this would be a case sometimes

203.44

that you would need you'd maybe want to

204.879

have multiple buttons or

206.159

actions or links or something like that

209.2

because of the complete option

212.319

but this sort of you know sort of nice

214.159

there so let's actually take that

216.959

and if we go up to our road maps

221.599

let's see actually let's look at our

224.84

tasks see how we've got this set up

227.12

let's do this

228

in our as we get down to

231.92

our what is that that's our goals let's

233.92

clean that up so that

235.28

it gets done a little bit better and

236.959

we're going to get rid of this whole

238.08

thing here we've we don't have any space

239.599

at the bottom

240.08

we didn't build that out right so i'm

242.72

going to cheat it a little bit

245.68

uh let's see so this is going to be

249.04

is that time frame it's time frame edit

252.08

so the first thing i want to do is i'm

253.519

going to clean this up a little bit so

254.799

let's take

256.72

ah that doesn't look too bad all we're

258.56

going to do

260.88

is now we're going to split this into

262.56

two divs

264.16

so the first one actually we can do it

265.68

from here because we're going to move

266.96

the buttons going to be in a different

268.32

div

275.919

and we're going to use that spacing much

278

as we did on the

279.44

task list so let's take a look at how do

281.28

we split that

282.72

out let's see so it was a button task

286.72

which we may keep at that let's change

289.36

that but that class over

291.759

so we'll go over here and he's going to

293.36

be

295.04

instead of a button info he's going to

296.56

be button task

299.759

and let's go back to that guy we had him

301.84

split but

303.84

we had them split actually a couple

305.039

places we had these remember we do this

307.52

by 12

308.639

there's 12 divisions across the

312

bootstrap so we've got 3 4 which is 7

315.44

plus 2 is 9 and 3 is 12. so what we're

317.68

going to do is we're just going to go

318.88

ahead

319.759

and do just two of these this time

324.639

and let's see how that looks so if we do

327.36

oops and that's in the let me just pull

329.44

the

331.36

that's all i need because i've already

332.56

got a class for both of those

334.639

divs so his class is tasks and he's

338.639

going to be an

339.32

md9 and this one oh he doesn't need one

343.199

so it's going to be

345.919

an md3 and let's take a look at how that

349.28

looks

350.8

so we go here and we see oops i did not

354.16

put

354.479

i want him inside the div so

357.6

whoops so i need to have my overall card

361.52

which i'm going to click on to edit and

363.759

then within it

366.88

i'm going to have two divs so i'm going

369.919

to change this up a little bit because

371.12

this is going to be now

372.4

so i'm going to have a div oops here

375.84

oops i just duplicated that on me

383.199

oops okay i did not paste that right so

386

let's do it this way so i'm going to

387.039

take that

389.28

and so i've got a name and status it's

391.84

going to be a dive

396.08

and he's going to be an md9 while the

397.919

other one's going to be within there and

399.52

he's going to be an md3

406.639

and if we look there we go so now he's

409.759

but he's on a different page

411.52

so let's oh so we got to wrap those as a

413.36

row

416.96

i'll do the whole thing can i have a div

418.8

row somewhere i

420.319

do not have one so i'm just going to

421.52

grab one more of those

426.4

so now

432.24

i'm going to combine those guys

441.039

like that

447.52

and we should be able to say well there

449.68

we go so now we've got our completes

450.88

down here and if we click on them we can

452.56

edit it

453.759

but let's get some space down there

457.52

and i'm going to do it in the most

460.56

blatant easy way to do it at this point

463.039

is i'm just going to throw some

465.199

breaks in there we'll come back to this

467.36

another time

468.4

and probably play around with that a

469.919

little bit but for now let's just open

472.24

that up a little bit

474.08

and so now actually i'm just going to

477.68

give myself a little bit of space here

479.12

so as i scroll down i've got some space

480.72

at the bottom i could

481.759

open that up or close that up a little

483.52

bit more if i wanted but for now

485.12

we're going to keep it that way so we

487.44

come in

488.16

let's start with road maps we click here

490.319

we can look at the children

492.879

and we can look at a given time frame

496.479

so i think we're good because we've got

498

our goals

499.68

we've got here if we edit nothing there

503.199

turn annual personal goals annual goals

506.96

and so uh what we oh and then we

510.879

have here we can go back up we didn't

512.479

actually keep our little button here

513.839

because we can just get room app to get

515.44

back

516.24

uh there's two of these actually now

518.399

because we've got

520

we're in home or task list

523.279

then oops first let's get these so if i

526.24

click on it we're gonna get rid of the

527.519

edits for

528.32

the to do and the tasks

534.16

which is probably both going to be a

536.48

task list

537.839

i think this will cover both of them so

540.959

let's see for the edit we're going to

542.56

get rid of that

547.04

and we'll actually do it all the way up

548.8

at the card level

552.32

whoop is that how i want to do it yes so

554.959

for each task i'm going to click on it

556.56

there and so now i can get rid of edit

559.44

and i don't need the break

562.959

so if i save it i got rid of that

567.12

and i'm getting a matching query does

569.2

not exist which will be

570.48

interesting uh let's see we are blowing

574.399

up in views it's going

578.88

uh line 127 oh the parent

583.839

it's probably because that does not

585.44

exist so if it has no parent then we're

587.44

probably blowing up so let's take a look

588.8

at that

590.32

if we go look at that guy

593.36

we will see that uh owner

596.72

oh that's not owner i don't have parent

598.48

mi task

602

so i did not add that in there for some

603.76

reason parent attachment time cement

606.48

owner let's go take a look at that

610

so if i go back in my look at my model

613.76

real quick to edit

617.44

edit task

620.88

and i think it gave me that at line 127.

625.44

so line 127.

630.959

so oh it's the time frame objects get

635.519

so if there's a p is in the

638.68

request.session

641.04

so that means if there's a parent then

643.68

he's going to try to get that one

645.68

and so let's just do this real quick

651.76

and let's see what it's spitting out for

654.56

us

654.88

if we rebuild that whoops

658.56

did it die on me where here we go

662.16

oh i need my parentheses there

665.839

so i need to go back to my view

669.36

my mistake

673.36

and so we're probably going to need to

674.64

do is clean this stuff out oh which we

676.56

do need to do because that

678

is that's our problem is when we do a

684.24

let's see so what we need to do is we

688.959

need to unset

690.88

our session when we do

694.32

a list because as we come into whoops

697.44

uh is it gonna let's see can i show it

699.68

to me

701.04

yeah so if i go into my list so here we

703.6

don't have

704.48

remember we set our roadmap and time

708.079

uh time period that we're setting those

711.44

because we had that context well we

712.88

don't have that context anymore

715.04

so what we need to do is we need to do a

717.12

clean session

720.48

and we're just going to call that when

722

we do list tasks so here

726.959

he needs to do i think you can do

730.279

request.clean

732

session

736.079

so

742.079

actually i don't think we to do it i

743.279

think we need to do it like this let's

744.8

sit this way

749.2

there because it's not a self my mistake

750.8

so if we do clean session now

754.639

what it's going to do is it still

757.36

getting it oh it says it is so let's

759.519

make sure

762.72

that we clean out our session properly

764.72

so now

773.2

oops it's probably because i'm not

774.8

cleaning the right one so let's do this

776.399

one so that's list tasks

778.8

oh and this is going to be the list

780.32

tasks with

782

oh that's edit tasks

785.44

oops so we have to do it here

792.16

i'm still getting it so let's take a

794.48

look at that so tasks

795.68

is calling

799.279

uh tasks is calling list tasks

804.399

so list tasks calls clean session

809.2

and so let's just do this

816.56

well actually what i need to do is uh

819.68

if he's in the session and

826

not equal to null i'm sorry not equal to

828.56

none

831.44

because that's what's going to happen as

832.639

it's coming through

840.24

oh and that's some and

845.04

so what's it complaining about one

846.959

second here

848.24

there we go i think that's gonna work

853.519

there we go so now we don't have uh and

857.44

so now this return to annual goals

859.92

is going to blow up because it doesn't

861.36

really have um

864.399

i don't think we have the right yeah

868.8

we're setting this incorrectly so if we

870.72

go into the edit task

875.519

let's see here uh parent equals parent

880.639

otherwise it equals none

886.16

so if we look here where it's just going

888.48

to be on

889.6

um edit task

892.88

well actually as i'm looking at the

894.079

clock we're running out of time so i'm

895.519

going to actually fix this next time

896.72

around but what we did do

898.48

this time around is we're clicking on

901.36

our stuff now to edit as opposed to

902.959

these

903.68

edit buttons everywhere i think that'll

905.36

take care of

907.519

all of our edits and we have to deal

911.12

with the

912.16

side effects of setting stuff up in the

914.24

session which is

915.36

part of the reason that it was it's

917.04

cleaner when you pass it

918.399

um but it's also sort of nice to

921.6

you know from a convenience point of

922.72

view to keep track of those sessions

925.279

and keeps track of stuff within the

927.279

session so we're going to clean that up

928.88

next time but for now we'll wrap it up

932.24

so go out there have yourself a great

933.6

day a great week and we will talk to you

936.72

next time

952.88

you