welcometothestartof a newtutorial, Siri's, andthisiscalledTeachMeJenga, whichis a projectbuiltwithDjangoandreact, showingyouhowyoucanworkwithmultipleusersin a kindofmockonlinesystemwhereyoucancreateassignments, filledtheminandseetheresultsofthoseassignmentsonyourprofile.
So I'm gonnagoaheadandlogin, and I alreadyhave a usercreatedforthis, andwedon't haveanyassignmentsjustyet, sowe'llgoaheadandcreateonesowe'llgiveit a title.
Andsobeforejudginghowcompletethisprojectisintermsofvalidationandseeingdetail, viewsandthinking, there's a lotmorestufftobedisplayedandthatthisisreallyjusttoobasic.
Andthenwehave a sourcefolderwhichhas a basicreactprojectsetup a swell.
Now I'lllink a videoshowingyoueverythingthat's containedinsidethisproject, whichrecoveredinoneofourvideos, showingyouhowtosetupwithindicationbetweenJangoandreact.
Soeverythinginthatvideowebasicallytookandjustcompileditinto a boilerplaterepositoriessothatwecouldjustpullthateasilysowedon't havetokeeponrepeatingourselvesthatway.
Wealreadyhave a nicesetuptogetstartedwith, andwecangetworkingfromhere.
Inobviouscodeeditor, we'vegottheHomedirectorywhichhas a basesettingsforalltheinstalledabs, middlewaytemplatesandsomeotherthingsthatwillneedforbothdevelopmentandproductionandthenindevelopment.
The W s jobapplicationfordevelopmentand a DBScollectthreedaughterbasesetupwiththelocalhostoff 3000 beinginourcourseoriginWhitelistandtheninproduction, we'vegotourdomainwithdrew.
NeedtoaddthedifferentWsJulyapplicationforproduction a daughterbasesetupforpostgracewhichwedon't actuallyhavethosecredentialssetupjustyet.
Soeithertrueorfalse, andthenwe'llhavetheisteacher, whichisalso a model's dotbrilliantfield.
Sothatmeansisthatwhenwecreatetheuser, we'regoingtoneedtopassinwhetherthisuseris a student, soeithertrueorfalseandreadingtoParson.
Ifit's a teacherandtheywilljustsaydefinethestringmethod, whichtakeshimselfandalsoreturnselfdogusednamebecauseremember, thisdoesn't hearitfromtheabstractuserthatisourbaseuser, andthatiswhatwillbeusingwhenwecreateourusers.
Nowwhat I'm alsogoingtodoisdefineanotherclassier, whichisthiefstudent, andthiswilljustbe a modelstopmodel.
Andallwe'redoingisbasically a signing a 1 to 1 fieldwiththeuser, sothatinsteadofworkingwiththebaseuserthatwecreatedhere, willworkwithstudentmodelwhenweneedtoreferto a anactualstudent.
Butit's just a littlebitmoreconvenientbecausehereonthestudent, youcouldthenpassing a lotmoreotherfields, likewhatclassroomstheybelongto, whatgradethey'rein, etcetera.
Youcoulddo a wholebunchofthingslikethat.
Weastheuser, youjustwanttodefinewhetherthatuses a studentor a teacher.
That's thewholepurposeoff.
Thismodelherewilljustsaythattheuserequalsto a 1 to 1 fieldwiththeuserthatwejustcreatedhereandwillsayondeleteequalstwomodelsdotcascadesothatiftheuserispleated, thentheirstudentistoleaditaswell.
Andthenwe'lljustsayDefinestring, whichtakeshimselfandsayReturnselfdotuserdot e mail, forexample, orusingit.
So, forexample, itsaysthreerestorserializeis a dictionarywheretheLoganserializeeris a pathto a customLoganserializeerandthesamethingforthetokenserializing.
Anditalsosays, yetyoucandefineyourcustom.
Serializeisforregistration, however, notethecustomofregisterserialize.
Hermustdefine a definesavemethodthatreturns a usermodelinstance, andthat's extremelyimportantifwe'regonnagetthisright.
Andhewillspecifytheclassmetaandsaythemodelis a user, andthenwe'llneedtospecifythefieldsandthefieldsisjust a listorfieldsonourmodelthatwewanttoincludeinthecerealizerNow.
Well, sayKloss, customregisterserializeer, justsothatwedon't have a reallylongnameandthisisgoingtoinheritfromtheregisterserializeer, andwecanseehereintheregisterserializedclass.
Sowecandeleteallofthatandjustpassinuserastheonjektwandwhatwe'regoingtodoisactuallychangethelocalstoragehandlingsothat, insteadofsettingtheitemof a tokenandanexpirationdate, wereratherjustgoingtosetanentireuserwhichwillholdthetokenusernameandallthedetailsaboutthatuser.
Sothatwaywecanstallwhethertheirstudentor a teacheraswell.
Itsavestheuserbypassinginthatnewuser, andwecanthengetridofthecustomsignupandthesetupuseemailandessentially, whatwewanttodoisnotonlygrabtheusernamepasswordoneand e mailwillactuallywanttocopyposturedone.
Sowehavepossible, too, thatwecanseeaswellandweactuallyalsowanttogettootherfieldswhicharetheisstudent, andheis a teacher.
Soyouhavetosayfromdotmodels, importuser, andthenwe'realsogoingtoneedourserializeissowe'lljustsayfromdotserializeer's import, theuserserializeerandwe'llmakethis a viewsetsothatit's not a lotofcode.
Sowe'llsayfromwristframeworkImportViewsets.
Andthenwe'lljustcreate a clauseuseofyousetthatwillinheritfromtheviewsetsmodel, view, setandall.
Andifwewentto, forexample, usersoneandput a slashontheendofaswell, thenwegettheinstanceofthisuser.
Sonowwhatwewanttodoistranslatethatintotheequivalentdisplayoff a user's profilehereinthefrontend.
Andsolet's goandcloseallofthisarthereandbasicallywherewewanttoworkisinsidesourceandwhatwehadstartedbyaddingandNewRoutierandthisrouteisgoingtogotoslashprofileandthenhavean I D attheendofthat, andwe'regoingtocreate a componentcalledprofiletohandlethat.
AndthenwejustwanttogetridoftheseConstancehereandsettheuserto a JasonStringoffireoftheEU's objectandthensayorthesuccessoffthatuser.
Andsonowifwegoandtrythatagainandweget a badrequestyouontheserver, solet's seewhythat's happening.
Ifwegoheretothepathin 3.6, itjustgivesus a badrequest.
Itdoesn't actuallytellusanythingaboutit.
Andsobasically, whatwewanttodoisgobacktoourserializeer's andactuallyconfigurehowwereceive a tokenfromtheserver.
Solet's headbacktotheusersapp.
Andifwegotoserializeisnowthereasonforthiscustomserializeissothatwhenwelogin, wereceivenotonlythekeyfromJangarrestormeaningthetoken, butwealsowanttoactuallygettheusertypeandthatbeingeither a studentorteacher.
Andif I refreshthepage, we'restilllockedin, whichmeansthatwearestoringourobjectcorrectlyinthelocalstorage.
Andnowthat's justgoingtoadd a linkhere, whichwilltakeustoourprofilesowe'lljustcomebackhereandwecancloseourserialIsarandbasedonPieandwewanttogointothelayoutsowe'llgotocontainerslayoutandwealreadyhaveconnectimported, whichwillallowustoaccessthesmapdispatchandmapstatetopropsfromreactreducks.
Andbasicallywhatwewanttodoisjustaddanotherbreadcrumbitemsowecanactuallyremovethelistitemhere, andwe'lljustmakethisprofileandthisisjustgoingtotakeustoprofilesandthenan I D.
Sowe'llcomehereandsaythattheuser i d equalstotheresponsetodrdotuser.
Rememberwhenwesawthatwhenweloggedouttheuserresponseintheconsole, andwe'lljustcopythatandgodownintothefourthsignupandalsopassithereinthisobjectusersofthat, inbothinstanceswewillgrabtheuser i d.
Andthatmeansthatinsideourreducer, we'llneedtopassinuse i d.
welcometothestartof a newtutorial, Siri's, andthisiscalledTeachMeJenga, whichis a projectbuiltwithDjangoandreact, showingyouhowyoucanworkwithmultipleusersin a kindofmockonlinesystemwhereyoucancreateassignments, filledtheminandseetheresultsofthoseassignmentsonyourprofile.
Subtitles and vocabulary
Click the word to look it upClick the word to find further inforamtion about it