title
Full Stack React & Django [1] - Basic REST API

description
In part 1 of this series we will setup a Django app and create a REST API with the Django Rest Framework. We will use Postman for API testing. Sponsor: DevMountain Bootcamp https://goo.gl/6q0dEa Code: https://github.com/bradtraversy/lead_manager_react_django Helpful Links & Tuorials: https://www.django-rest-framework.org https://www.valentinog.com/blog/tutorial-api-django-rest-react/#Django_REST_with_React_Django_and_React_together http://v1k45.com/blog/modern-django-part-1-setting-up-django-and-react/ 💖 Become a Patron: Show support & get perks! http://www.patreon.com/traversymedia Website & Udemy Courses http://www.traversymedia.com Follow Traversy Media: https://www.facebook.com/traversymedia https://www.twitter.com/traversymedia https://www.instagram.com/traversymedia

detail
{'title': 'Full Stack React & Django [1] - Basic REST API', 'heatmap': [{'end': 274.7, 'start': 243.617, 'weight': 0.7}, {'end': 319.644, 'start': 299.678, 'weight': 0.719}, {'end': 387.081, 'start': 365.949, 'weight': 0.841}, {'end': 439.236, 'start': 416.809, 'weight': 0.734}, {'end': 795.598, 'start': 772.621, 'weight': 0.945}, {'end': 943.962, 'start': 924.509, 'weight': 1}, {'end': 1090.068, 'start': 1060.092, 'weight': 0.845}], 'summary': 'Series covers building a full stack application with react, redux, and django, including setting up python 3, creating models and apis with django, api testing with postman, and creating a django rest api with crud operations, offering a comprehensive guide for developers.', 'chapters': [{'end': 199.142, 'segs': [{'end': 50.786, 'src': 'embed', 'start': 24.269, 'weight': 0, 'content': [{'end': 30.193, 'text': "So in this series we're going to be building a full stack application with React, Redux and Django.", 'start': 24.269, 'duration': 5.924}, {'end': 30.993, 'text': 'All right.', 'start': 30.653, 'duration': 0.34}, {'end': 34.535, 'text': "Now, this isn't going to be like a really quick cookie cutter tutorial.", 'start': 31.133, 'duration': 3.402}, {'end': 41.46, 'text': "We're going to jump in and we're going to write quite a bit of code, especially in React and Redux, because the Django API,", 'start': 34.856, 'duration': 6.604}, {'end': 45.562, 'text': "we're using something called the Django rest framework, which is very high level.", 'start': 41.46, 'duration': 4.102}, {'end': 50.786, 'text': "So we don't have to write a ton of code in order to get what we need as far as functionality.", 'start': 45.642, 'duration': 5.144}], 'summary': 'Building full stack app with react, redux, and django using django rest framework. involves writing substantial code in react and redux.', 'duration': 26.517, 'max_score': 24.269, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs24269.jpg'}, {'end': 116.794, 'src': 'embed', 'start': 65.871, 'weight': 1, 'content': [{'end': 71.793, 'text': "it's just a lead manager where we can add leads with a name email message.", 'start': 65.871, 'duration': 5.922}, {'end': 77.675, 'text': "but, like i said, we'll have authentication, we'll be able to log in and each user will have their own leads.", 'start': 71.793, 'duration': 5.882}, {'end': 85.12, 'text': "So if I create a lead as one user and then log in as another, I won't be able to see or manage the other person's lead.", 'start': 78.215, 'duration': 6.905}, {'end': 91.605, 'text': "So it's something that I think you'll learn a lot from on both sides, Django and React.", 'start': 86.101, 'duration': 5.504}, {'end': 94.608, 'text': "So hopefully you enjoy it and let's get started.", 'start': 92.506, 'duration': 2.102}, {'end': 101.35, 'text': 'Now, this is the documentation for Django rest framework, which is very, very in-depth.', 'start': 95.348, 'duration': 6.002}, {'end': 108.312, 'text': 'All the different concepts are here, such as view sets, which will be using serializers, routers, all that stuff.', 'start': 101.47, 'duration': 6.842}, {'end': 112.393, 'text': 'And then this is a tutorial that I kind of based this upon.', 'start': 108.932, 'duration': 3.461}, {'end': 114.273, 'text': 'But this is very simple.', 'start': 113.153, 'duration': 1.12}, {'end': 115.434, 'text': "They don't use redux.", 'start': 114.313, 'duration': 1.121}, {'end': 116.794, 'text': "They don't use authentication.", 'start': 115.474, 'duration': 1.32}], 'summary': 'Create lead manager with authentication for individual user access, utilizing django and react.', 'duration': 50.923, 'max_score': 65.871, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs65871.jpg'}, {'end': 177.421, 'src': 'embed', 'start': 136.065, 'weight': 4, 'content': [{'end': 145.751, 'text': 'so usually what i would do is i would have a standalone api and then a standalone react single page app, like like um Number two.', 'start': 136.065, 'duration': 9.686}, {'end': 150.812, 'text': "here what we're going to do is have React in its own front end Django app.", 'start': 145.751, 'duration': 5.061}, {'end': 157.233, 'text': "OK, so we're going to create a special app for React where we install Webpack, we install React, React Dom, all that stuff.", 'start': 150.832, 'duration': 6.401}, {'end': 161.614, 'text': 'And then we load a single HTML template and let React manage the front end.', 'start': 157.653, 'duration': 3.961}, {'end': 163.854, 'text': "OK, so that's what we'll be doing.", 'start': 162.294, 'duration': 1.56}, {'end': 166.975, 'text': 'And I will put this tutorial link in the description.', 'start': 163.894, 'duration': 3.081}, {'end': 171.616, 'text': 'And then this is another five part tutorial with Django and React.', 'start': 167.395, 'duration': 4.221}, {'end': 177.421, 'text': 'And basically, I got a lot of ideas for authentication from part four of this tutorial.', 'start': 172.617, 'duration': 4.804}], 'summary': 'Integrating react into django app for front end management.', 'duration': 41.356, 'max_score': 136.065, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs136065.jpg'}], 'start': 7.059, 'title': 'Full stack application with react and django', 'summary': 'Focuses on building a full stack application with react, redux, and django, including the use of django rest framework, authentication with tokens, and creating a lead manager application. it also covers the django rest framework documentation and the implementation of react in a django app for front-end management.', 'chapters': [{'end': 91.605, 'start': 7.059, 'title': 'Building full stack application with react, redux and django', 'summary': 'Discusses building a full stack application with react, redux, and django, including the use of django rest framework, implementation of authentication with tokens, and the creation of a lead manager application that allows adding leads with name, email, and message, with user-specific access.', 'duration': 84.546, 'highlights': ['The chapter covers building a full stack application with React, Redux, and Django, focusing on the creation of a lead manager application with authentication and user-specific access.', 'The tutorial emphasizes the use of Django rest framework, which minimizes the need for excessive code to achieve desired functionality.', "The application's functionality includes the ability to add leads with name, email, and message, with each user having access only to their own leads."]}, {'end': 199.142, 'start': 92.506, 'title': 'Django rest framework documentation and react implementation', 'summary': 'Introduces the django rest framework documentation and discusses the implementation of react in a django app, emphasizing the integration of react for front-end management.', 'duration': 106.636, 'highlights': ['The chapter discusses the in-depth documentation of Django rest framework, including concepts like view sets, serializers, and routers, providing a comprehensive understanding of the framework.', 'The implementation of React in a Django app is highlighted, emphasizing the unique approach of integrating React for front-end management within its own special app, utilizing Webpack and libraries like React Dom.', 'The tutorial link for the React implementation is provided, along with references to a five-part tutorial with Django and React for authentication ideas, encouraging users to refer to the tutorials as a supplement to aid in understanding the concepts and implementations.']}], 'duration': 192.083, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs7059.jpg', 'highlights': ['The chapter covers building a full stack application with React, Redux, and Django, focusing on the creation of a lead manager application with authentication and user-specific access.', 'The tutorial emphasizes the use of Django rest framework, which minimizes the need for excessive code to achieve desired functionality.', "The application's functionality includes the ability to add leads with name, email, and message, with each user having access only to their own leads.", 'The chapter discusses the in-depth documentation of Django rest framework, including concepts like view sets, serializers, and routers, providing a comprehensive understanding of the framework.', 'The implementation of React in a Django app is highlighted, emphasizing the unique approach of integrating React for front-end management within its own special app, utilizing Webpack and libraries like React Dom.', 'The tutorial link for the React implementation is provided, along with references to a five-part tutorial with Django and React for authentication ideas, encouraging users to refer to the tutorials as a supplement to aid in understanding the concepts and implementations.']}, {'end': 582.534, 'segs': [{'end': 230.193, 'src': 'embed', 'start': 199.662, 'weight': 7, 'content': [{'end': 202.646, 'text': 'And then you want to make sure you have Python three installed.', 'start': 199.662, 'duration': 2.984}, {'end': 204.388, 'text': "I'm going to make this a little bigger.", 'start': 202.906, 'duration': 1.482}, {'end': 212.306, 'text': 'So if I do Python three dash dash version, you can see I have three point seven point zero.', 'start': 206.425, 'duration': 5.881}, {'end': 215.667, 'text': "I believe three point seven two is the latest, but that's fine.", 'start': 212.747, 'duration': 2.92}, {'end': 220.288, 'text': "If you don't have Python three, just go to Python dot org and download and install it.", 'start': 216.047, 'duration': 4.241}, {'end': 224.83, 'text': 'Now, since I have to use Python three, I have to.', 'start': 221.269, 'duration': 3.561}, {'end': 230.193, 'text': "Why isn't this clearing? I have to use PIP three if I want to install something globally.", 'start': 225.11, 'duration': 5.083}], 'summary': 'Ensure python 3.7.0 is installed; use pip3 for global installations.', 'duration': 30.531, 'max_score': 199.662, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs199662.jpg'}, {'end': 299.638, 'src': 'heatmap', 'start': 243.617, 'weight': 0, 'content': [{'end': 250.219, 'text': 'So you just want to run PIP three or PIP, whatever one is Python three and then PIP ENV.', 'start': 243.617, 'duration': 6.602}, {'end': 253.56, 'text': 'Mine will go really quick because I already have installed.', 'start': 251.139, 'duration': 2.421}, {'end': 254.512, 'text': 'All right.', 'start': 254.192, 'duration': 0.32}, {'end': 262.7, 'text': "Once you do that, you can just do pipenv shell and that's going to go ahead and create a virtual environment for our project.", 'start': 254.592, 'duration': 8.108}, {'end': 265.262, 'text': "And it's going to create something called a pip file.", 'start': 263.14, 'duration': 2.122}, {'end': 270.667, 'text': "So I'm going to actually open VS code in this directory.", 'start': 266.363, 'duration': 4.304}, {'end': 274.7, 'text': "And over here, you'll see we have a pip file.", 'start': 272.618, 'duration': 2.082}, {'end': 278.683, 'text': 'And this is where all of our packages will go when we install any packages.', 'start': 275.16, 'duration': 3.523}, {'end': 281.225, 'text': 'So I want to install a few things.', 'start': 279.463, 'duration': 1.762}, {'end': 282.946, 'text': "So I'm going to say pipenv.", 'start': 281.265, 'duration': 1.681}, {'end': 287.429, 'text': "And let's do install django.", 'start': 284.467, 'duration': 2.962}, {'end': 299.638, 'text': 'We also want django rest framework and then something called django-rest-nox, which has to do with token authentication.', 'start': 288.53, 'duration': 11.108}], 'summary': 'Using pipenv to create a virtual environment and install django, django rest framework, and django-rest-nox for token authentication in python 3.', 'duration': 56.021, 'max_score': 243.617, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs243617.jpg'}, {'end': 331.218, 'src': 'heatmap', 'start': 299.678, 'weight': 0.719, 'content': [{'end': 300.719, 'text': "We'll get into that later.", 'start': 299.678, 'duration': 1.041}, {'end': 308.534, 'text': "So let's install these three things and you'll see that they're going to get added here to our packages.", 'start': 301.348, 'duration': 7.186}, {'end': 313.118, 'text': "It's also going to create a lock file with all the dependencies in their versions.", 'start': 308.554, 'duration': 4.564}, {'end': 319.644, 'text': "And then once that's done, I'm going to generate a new Django app.", 'start': 314.44, 'duration': 5.204}, {'end': 322.647, 'text': "So I'm going to say Django dash admin.", 'start': 319.664, 'duration': 2.983}, {'end': 325.709, 'text': "And let's say start project.", 'start': 323.886, 'duration': 1.823}, {'end': 327.572, 'text': 'I should say a Django project.', 'start': 326.03, 'duration': 1.542}, {'end': 331.218, 'text': 'A project and an app are two different things in the Django world.', 'start': 327.612, 'duration': 3.606}], 'summary': 'Installing three packages, creating lock file, and generating django app.', 'duration': 31.54, 'max_score': 299.678, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs299678.jpg'}, {'end': 402.452, 'src': 'heatmap', 'start': 365.949, 'weight': 1, 'content': [{'end': 373.413, 'text': "So just go ahead and do a command shift P or control shift P and start to type in Python and you'll see select interpreter.", 'start': 365.949, 'duration': 7.464}, {'end': 378.176, 'text': 'And you want to make sure you select the one that has your folder name and then pipenv.', 'start': 374.153, 'duration': 4.023}, {'end': 379.917, 'text': 'OK, make sure you do that.', 'start': 378.196, 'duration': 1.721}, {'end': 381.238, 'text': 'All right.', 'start': 379.937, 'duration': 1.301}, {'end': 387.081, 'text': "Next thing we're going to do is we're going to generate a Django app.", 'start': 381.698, 'duration': 5.383}, {'end': 391.164, 'text': "Like I said, there's a concept of apps, so different parts of your project.", 'start': 387.321, 'duration': 3.843}, {'end': 393.145, 'text': 'And we want one called leads.', 'start': 391.704, 'duration': 1.441}, {'end': 400.731, 'text': "So I'm going to say Python manage dot pi start app.", 'start': 393.766, 'duration': 6.965}, {'end': 402.452, 'text': "And we're going to call this leads.", 'start': 401.091, 'duration': 1.361}], 'summary': 'Use command shift p to select python interpreter and create a django app named leads.', 'duration': 74.84, 'max_score': 365.949, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs365949.jpg'}, {'end': 450.585, 'src': 'heatmap', 'start': 416.809, 'weight': 3, 'content': [{'end': 422.58, 'text': 'Now, in settings, you have this installed apps list and you just want to add your app to this.', 'start': 416.809, 'duration': 5.771}, {'end': 423.842, 'text': 'so leads.', 'start': 422.58, 'duration': 1.262}, {'end': 429.473, 'text': "and then, since we're using Django rest framework, we need to also add rest framework.", 'start': 423.842, 'duration': 5.631}, {'end': 431.569, 'text': 'All right now.', 'start': 431.069, 'duration': 0.5}, {'end': 439.236, 'text': "as far as the database, I'm just going to stick with SQLite, which is the default, just so I don't have to install Postgres or get that set up.", 'start': 431.569, 'duration': 7.667}, {'end': 440.737, 'text': 'But if you want to do that, you can.', 'start': 439.276, 'duration': 1.461}, {'end': 450.585, 'text': 'Just make sure MySQL or Postgres, whatever you want to use, is on your system and you put in the engine the password, database, name, stuff like that.', 'start': 441.177, 'duration': 9.408}], 'summary': 'Adding app to installed apps list and using sqlite as default database.', 'duration': 33.776, 'max_score': 416.809, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs416809.jpg'}, {'end': 523.563, 'src': 'embed', 'start': 494.979, 'weight': 2, 'content': [{'end': 497.241, 'text': "So let's do name equals model.model.", 'start': 494.979, 'duration': 2.262}, {'end': 498.808, 'text': 'char field.', 'start': 498.047, 'duration': 0.761}, {'end': 502.192, 'text': "That's what I'm going to use, which is just like text.", 'start': 498.848, 'duration': 3.344}, {'end': 506.516, 'text': "Then I'm going to do a max length of 100.", 'start': 502.212, 'duration': 4.304}, {'end': 507.778, 'text': 'That should be good for the name.', 'start': 506.516, 'duration': 1.262}, {'end': 510.1, 'text': "And we're going to have an email.", 'start': 508.719, 'duration': 1.381}, {'end': 515.366, 'text': "So models dot and there's actually an email field.", 'start': 511.582, 'duration': 3.784}, {'end': 523.563, 'text': "will validate it as an email and we'll set a max length for that to 100 as well.", 'start': 516.857, 'duration': 6.706}], 'summary': 'Creating a model with a name field of max length 100 and an email field with a max length of 100 and email validation.', 'duration': 28.584, 'max_score': 494.979, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs494979.jpg'}], 'start': 199.662, 'title': 'Setting up python 3 and django app creation', 'summary': "Covers setting up python 3, installing pip env, creating a virtual environment, and installing django, django rest framework, and django-rest-nox. it also demonstrates creating a django app named 'lead manager' and setting up the python interpreter, and adding the 'leads' app to the project settings. additionally, it covers setting up django rest framework and creating a model with fields for name, email, message, and created at, including details about field types and validations.", 'chapters': [{'end': 327.572, 'start': 199.662, 'title': 'Setting up python 3 and installing django', 'summary': 'Covers setting up python 3, installing pip env, creating a virtual environment, and installing django, django rest framework, and django-rest-nox.', 'duration': 127.91, 'highlights': ["Python 3 installation and version check Ensure Python 3 is installed by running 'python3 --version', with the latest version being 3.7.2.", 'Installing PIP ENV for creating virtual environment Use PIP3 to install PIP ENV, enabling the creation of a virtual environment for installing packages.', "Creating a virtual environment and installing packages Run 'pipenv shell' to create a virtual environment, then install packages like Django, django rest framework, and django-rest-nox using 'pipenv install'."]}, {'end': 423.842, 'start': 327.612, 'title': 'Creating a django app', 'summary': "Demonstrates the process of creating a django app named 'lead manager', including creating the app folder, setting up the python interpreter, and adding the 'leads' app to the project settings.", 'duration': 96.23, 'highlights': ['Creating a folder called lead manager with manage.pi file, serving as the CLI for Django. The creation of the lead manager folder with the manage.pi file, serving as the CLI for Django, is a key step in the process.', "Selecting the correct environment for the Python interpreter by using 'command shift P' or 'control shift P' and choosing the one with the folder name and 'pipenv'. Selecting the correct environment for the Python interpreter is crucial, and it involves using 'command shift P' or 'control shift P' and choosing the one with the folder name and 'pipenv'.", "Generating a Django app named 'leads' and adding it to the installed apps list in the settings file. The generation of the 'leads' app and its addition to the installed apps list in the settings file is a fundamental part of creating the Django app."]}, {'end': 582.534, 'start': 423.842, 'title': 'Django rest framework and model creation', 'summary': 'Covers setting up django rest framework and creating a model with fields for name, email, message, and created at, including details about field types and validations.', 'duration': 158.692, 'highlights': ['The chapter covers setting up Django Rest Framework and creating a model with fields for name, email, message, and created at, including details about field types and validations.', 'Setting up Django Rest Framework involves adding the rest framework to the project, while the database configuration can use SQLite as the default, with the option to use MySQL or Postgres.', 'Creating a model involves defining fields such as name, email, message, and created at, with specific field types and validations like max length, unique, and blank.']}], 'duration': 382.872, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs199662.jpg', 'highlights': ["Creating a virtual environment and installing packages Run 'pipenv shell' to create a virtual environment, then install packages like Django, django rest framework, and django-rest-nox using 'pipenv install'.", "Generating a Django app named 'leads' and adding it to the installed apps list in the settings file. The generation of the 'leads' app and its addition to the installed apps list in the settings file is a fundamental part of creating the Django app.", 'Creating a model involves defining fields such as name, email, message, and created at, with specific field types and validations like max length, unique, and blank.', 'Setting up Django Rest Framework involves adding the rest framework to the project, while the database configuration can use SQLite as the default, with the option to use MySQL or Postgres.', 'Installing PIP ENV for creating virtual environment Use PIP3 to install PIP ENV, enabling the creation of a virtual environment for installing packages.', "Selecting the correct environment for the Python interpreter by using 'command shift P' or 'control shift P' and choosing the one with the folder name and 'pipenv'. Selecting the correct environment for the Python interpreter is crucial, and it involves using 'command shift P' or 'control shift P' and choosing the one with the folder name and 'pipenv'.", 'Creating a folder called lead manager with manage.pi file, serving as the CLI for Django. The creation of the lead manager folder with the manage.pi file, serving as the CLI for Django, is a key step in the process.', "Python 3 installation and version check Ensure Python 3 is installed by running 'python3 --version', with the latest version being 3.7.2."]}, {'end': 1072.275, 'segs': [{'end': 616.053, 'src': 'embed', 'start': 583.054, 'weight': 3, 'content': [{'end': 585.335, 'text': "That way it'll just add the date automatically.", 'start': 583.054, 'duration': 2.281}, {'end': 587.977, 'text': "OK so let's save that and that's our model.", 'start': 585.355, 'duration': 2.622}, {'end': 596.098, 'text': "Now we're creating the model doesn't do anything other than just creating a file.", 'start': 589.713, 'duration': 6.385}, {'end': 603.764, 'text': 'We need to actually create a migration and then run that migration in order to put that table and that those columns in the database.', 'start': 596.158, 'duration': 7.606}, {'end': 608.128, 'text': "So back in our terminal here, we're going to run.", 'start': 604.445, 'duration': 3.683}, {'end': 616.053, 'text': 'python manage.py make migrations leads.', 'start': 609.409, 'duration': 6.644}], 'summary': 'Creating a model and running a migration to add a table and columns to the database.', 'duration': 32.999, 'max_score': 583.054, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs583054.jpg'}, {'end': 710.85, 'src': 'embed', 'start': 636.003, 'weight': 2, 'content': [{'end': 646.188, 'text': 'And Django by default has a bunch of migrations to run because it creates a bunch of default tables for things like users and permissions and stuff like that.', 'start': 636.003, 'duration': 10.185}, {'end': 653.612, 'text': "All right, so now that we have our database set up, let's start to think about our API.", 'start': 647.691, 'duration': 5.921}, {'end': 659.674, 'text': 'Now, with the rest framework, we create something called a serializer.', 'start': 654.133, 'duration': 5.541}, {'end': 662.555, 'text': 'And serializers, as you can see,', 'start': 660.914, 'duration': 1.641}, {'end': 671.417, 'text': 'allow complex data such as query sets and model instances to be converted to Python data types that can be easily rendered to JSON,', 'start': 662.555, 'duration': 8.862}, {'end': 673.117, 'text': 'XML and other content types.', 'start': 671.417, 'duration': 1.7}, {'end': 675.458, 'text': 'So this is obviously going to be a JSON API.', 'start': 673.157, 'duration': 2.301}, {'end': 676.998, 'text': "That's what we wanted to serve.", 'start': 675.758, 'duration': 1.24}, {'end': 685.186, 'text': 'So, we need to create a serializer to take our model or our query set of leads and turn it into JSON.', 'start': 677.658, 'duration': 7.528}, {'end': 694.154, 'text': "So, I mean, there's a lot of different ways to do this, but we're going to do something very, very simple, which is right here.", 'start': 685.926, 'duration': 8.228}, {'end': 698.819, 'text': 'Create a serializer class and then a class of meta.', 'start': 695.235, 'duration': 3.584}, {'end': 702.502, 'text': 'Basically going to overwrite the class of meta or add to it.', 'start': 699.179, 'duration': 3.323}, {'end': 706.126, 'text': 'Set the model to lead and then set our fields.', 'start': 703.003, 'duration': 3.123}, {'end': 707.808, 'text': "Alright, so let's do that.", 'start': 706.887, 'duration': 0.921}, {'end': 710.85, 'text': "Let's go into our leads folder or leads app.", 'start': 707.868, 'duration': 2.982}], 'summary': 'Using django and rest framework to create a json api with serializers for model instances and query sets.', 'duration': 74.847, 'max_score': 636.003, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs636003.jpg'}, {'end': 800.488, 'src': 'heatmap', 'start': 772.621, 'weight': 0.945, 'content': [{'end': 776.604, 'text': 'Now we could do fields and we could put like name email.', 'start': 772.621, 'duration': 3.983}, {'end': 781.668, 'text': "I'm just going to put all we can just do this double underscore all like that.", 'start': 776.924, 'duration': 4.744}, {'end': 784.45, 'text': "OK, so that's our serializer.", 'start': 781.688, 'duration': 2.762}, {'end': 788.653, 'text': 'Now, the next thing we need to do is create our API.', 'start': 785.15, 'duration': 3.503}, {'end': 795.598, 'text': "So inside the leads folder, I'm going to create a new file called API dot pi.", 'start': 789.293, 'duration': 6.305}, {'end': 800.488, 'text': "And in here I'm going to bring in the model.", 'start': 797.566, 'duration': 2.922}], 'summary': 'Creating a serializer with name and email fields and an api file for a model', 'duration': 27.867, 'max_score': 772.621, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs772621.jpg'}, {'end': 880.489, 'src': 'embed', 'start': 853.613, 'weight': 0, 'content': [{'end': 857.415, 'text': "It's kind of like how Ruby on Rails works with the resources.", 'start': 853.613, 'duration': 3.802}, {'end': 865.581, 'text': 'And if you want to read more about it, you can go to view sets, and this will give you some more information about it.', 'start': 858.376, 'duration': 7.205}, {'end': 870.624, 'text': "so we create a view set and then we don't even have to create explicit routes.", 'start': 866.141, 'duration': 4.483}, {'end': 880.489, 'text': "we can use what's called the default router and just basically register an endpoint like api, slash leads, and then we can make get requests,", 'start': 870.624, 'duration': 9.865}], 'summary': 'Using view sets in python to create endpoints and make get requests.', 'duration': 26.876, 'max_score': 853.613, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs853613.jpg'}, {'end': 952.702, 'src': 'heatmap', 'start': 924.509, 'weight': 1, 'content': [{'end': 926.69, 'text': "But for now, it'll just be wide open.", 'start': 924.509, 'duration': 2.181}, {'end': 933.173, 'text': 'And then we need to just specify a serialized class, which is the lead serializer that we created.', 'start': 927.491, 'duration': 5.682}, {'end': 934.074, 'text': 'All right.', 'start': 933.833, 'duration': 0.241}, {'end': 934.714, 'text': "So that's it.", 'start': 934.114, 'duration': 0.6}, {'end': 935.375, 'text': 'Save that.', 'start': 934.774, 'duration': 0.601}, {'end': 939.058, 'text': 'Now we need to create our URLs.', 'start': 936.716, 'duration': 2.342}, {'end': 943.962, 'text': "Now, if we look in lead manager, there's a root URLs dot pie file.", 'start': 939.638, 'duration': 4.324}, {'end': 945.744, 'text': 'Let me just get rid of these comments.', 'start': 943.982, 'duration': 1.762}, {'end': 952.702, 'text': "and by default there's the admin, because django does come with an admin area.", 'start': 947.459, 'duration': 5.243}], 'summary': 'Creating a lead serializer and setting up urls in a django project.', 'duration': 28.193, 'max_score': 924.509, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs924509.jpg'}, {'end': 1072.275, 'src': 'embed', 'start': 1043.065, 'weight': 1, 'content': [{'end': 1047.547, 'text': "And then we pass in our view set and then just the name, which we're going to call leads.", 'start': 1043.065, 'duration': 4.482}, {'end': 1051.109, 'text': 'And then finally, for our URL patterns.', 'start': 1048.828, 'duration': 2.281}, {'end': 1060.092, 'text': 'OK. so instead of doing this URL patterns and then just a list of different paths,', 'start': 1051.129, 'duration': 8.963}, {'end': 1068.196, 'text': "we're simply going to set it to router dot URLs and that'll basically just give us the URLs that were registered for this endpoint.", 'start': 1060.092, 'duration': 8.104}, {'end': 1072.275, 'text': "And that's it, we should have a basic CRUD API.", 'start': 1069.252, 'duration': 3.023}], 'summary': "Creating a basic crud api with 'leads' as the endpoint and using router dot urls for url patterns.", 'duration': 29.21, 'max_score': 1043.065, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs1043065.jpg'}], 'start': 583.054, 'title': 'Django api and model creation', 'summary': 'Covers creating models, running migrations, and creating an api with django, as well as creating a json api, including serializer creation, view set development, and url configuration using the default router from the django rest framework.', 'chapters': [{'end': 662.555, 'start': 583.054, 'title': 'Creating model, running migration, and creating api with django', 'summary': 'Covers creating a model, running migration to put the table and columns in the database, and creating a serializer for the api with django.', 'duration': 79.501, 'highlights': ['Creating a migration and running it will put the table and columns in the database.', 'Django by default has a bunch of migrations to run because it creates default tables for users and permissions.', 'Starting to think about the API involves creating a serializer with the rest framework.']}, {'end': 1072.275, 'start': 662.555, 'title': 'Creating a json api with django', 'summary': 'Discusses the process of creating a json api with django, which involves creating a serializer to convert model instances to json, developing a view set for crud functionality, and configuring urls using the default router from the django rest framework.', 'duration': 409.72, 'highlights': ['Creating a view set allows for the creation of a full CRUD API, enabling functionalities like create, read, update, and delete without specifying explicit methods, similar to Ruby on Rails resources.', 'The serializer class is created to convert the lead model or query set of leads into JSON, simplifying the process by setting the model and fields in the meta class.', 'Configuring the URLs using the default router from the Django rest framework for the API, which eliminates the need to explicitly create paths and generates the necessary URLs for the specified endpoint.']}], 'duration': 489.221, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs583054.jpg', 'highlights': ['Creating a view set allows for the creation of a full CRUD API, enabling functionalities like create, read, update, and delete without specifying explicit methods, similar to Ruby on Rails resources.', 'Configuring the URLs using the default router from the Django rest framework for the API, which eliminates the need to explicitly create paths and generates the necessary URLs for the specified endpoint.', 'The serializer class is created to convert the lead model or query set of leads into JSON, simplifying the process by setting the model and fields in the meta class.', 'Creating a migration and running it will put the table and columns in the database.', 'Django by default has a bunch of migrations to run because it creates default tables for users and permissions.', 'Starting to think about the API involves creating a serializer with the rest framework.']}, {'end': 1360.409, 'segs': [{'end': 1132.419, 'src': 'embed', 'start': 1072.395, 'weight': 1, 'content': [{'end': 1076.279, 'text': 'So we can test this out by running our server.', 'start': 1072.395, 'duration': 3.884}, {'end': 1082.325, 'text': "Let's clear this up and let's run python manage.py runserver.", 'start': 1076.319, 'duration': 6.006}, {'end': 1086.226, 'text': "OK, as you can see, it's on eight thousand.", 'start': 1084.364, 'duration': 1.862}, {'end': 1087.707, 'text': "Now I'm going to open up Postman.", 'start': 1086.246, 'duration': 1.461}, {'end': 1090.068, 'text': "That's what I'm going to use to make my requests.", 'start': 1087.747, 'duration': 2.321}, {'end': 1092.73, 'text': "If you want to use something different, that's fine.", 'start': 1090.609, 'duration': 2.121}, {'end': 1098.455, 'text': 'But Postman is friggin fantastic and easy to use so we can make all types of requests.', 'start': 1092.831, 'duration': 5.624}, {'end': 1100.957, 'text': "So I'm going to make a get request to HTTP.", 'start': 1098.935, 'duration': 2.022}, {'end': 1110.145, 'text': 'local host colon eight thousand slash API slash leads.', 'start': 1103.081, 'duration': 7.064}, {'end': 1116.949, 'text': "OK, so what we get is an empty array, which is what we should get because we didn't add any leads.", 'start': 1111.606, 'duration': 5.343}, {'end': 1125.955, 'text': "So let's open up a new tab and let's make a post request and let's make a post request to the same URL.", 'start': 1117.59, 'duration': 8.365}, {'end': 1132.419, 'text': "However, we're going to add four headers, we want to add a content type.", 'start': 1127.676, 'duration': 4.743}], 'summary': 'Using postman, tested server on port 8000, made get request to /api/leads, received empty array, then made post request with four headers.', 'duration': 60.024, 'max_score': 1072.395, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs1072395.jpg'}, {'end': 1360.409, 'src': 'embed', 'start': 1325.836, 'weight': 0, 'content': [{'end': 1333.36, 'text': 'So we have a full CRUD API and you can see it was a very small amount of code that we that we wrote because we used a view set.', 'start': 1325.836, 'duration': 7.524}, {'end': 1338.922, 'text': "so i planned on this video being longer, but i think it's a good place to stop just because it's.", 'start': 1333.98, 'duration': 4.942}, {'end': 1342.503, 'text': "we've completed a just a simple django rest api.", 'start': 1338.922, 'duration': 3.581}, {'end': 1351.886, 'text': "so in the next video we'll start to implement react and, like i said, we're going to create a django app called front end and we'll install webpack,", 'start': 1342.503, 'duration': 9.383}, {'end': 1353.227, 'text': 'react, react, dom.', 'start': 1351.886, 'duration': 1.341}, {'end': 1358.948, 'text': 'all the stuff we need to be able to compile a react application in that front end app.', 'start': 1353.227, 'duration': 5.721}, {'end': 1360.409, 'text': "all right, so i'll see you in the next video.", 'start': 1358.948, 'duration': 1.461}], 'summary': 'Developed a full crud api with minimal code, ready to implement react in the next video.', 'duration': 34.573, 'max_score': 1325.836, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs1325836.jpg'}], 'start': 1072.395, 'title': 'Api testing and django rest api creation', 'summary': 'Covers testing an api with postman, including making a get request to localhost:8000/api/leads and receiving an empty array, followed by making a post request with four headers. it also demonstrates creating a django rest api with crud operations, using view sets to minimize code, and discusses the plan to implement react in the next video.', 'chapters': [{'end': 1132.419, 'start': 1072.395, 'title': 'Testing api with postman', 'summary': 'Demonstrates the process of testing an api using postman, making a get request to localhost:8000/api/leads and receiving an empty array, followed by making a post request with four headers.', 'duration': 60.024, 'highlights': ['Making a get request to localhost:8000/API/leads results in an empty array. The chapter demonstrates making a get request to localhost:8000/API/leads, which returns an empty array, indicating the absence of leads in the API.', 'Process of making a post request with four headers. The transcript details the process of making a post request with four headers to the same URL, showcasing the addition of headers during the API testing procedure.', 'Using Postman for API testing due to its ease of use. The speaker recommends using Postman for API testing, highlighting its ease of use and effectiveness in making various types of requests.']}, {'end': 1360.409, 'start': 1135.289, 'title': 'Creating a django rest api', 'summary': 'Demonstrates creating a django rest api with crud operations, using view sets to minimize code, and discusses the plan to implement react in the next video.', 'duration': 225.12, 'highlights': ['The chapter demonstrates how to create a Django REST API with full CRUD functionality using a view set, minimizing the amount of code required.', 'It shows the process of creating, reading, updating, and deleting leads in the database, with examples of successful requests and handling of errors.', "The presenter mentions the plan to implement React in the next video, detailing the installation of required tools and the creation of a front end app called 'front end'."]}], 'duration': 288.014, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Uyei2iDA4Hs/pics/Uyei2iDA4Hs1072395.jpg', 'highlights': ['The chapter demonstrates creating a Django REST API with full CRUD functionality using a view set, minimizing code.', 'Making a get request to localhost:8000/API/leads results in an empty array, indicating the absence of leads in the API.', 'The process of making a post request with four headers is detailed, showcasing the addition of headers during the API testing procedure.', "The presenter mentions the plan to implement React in the next video, detailing the installation of required tools and the creation of a front end app called 'front end'.", 'Using Postman for API testing is recommended due to its ease of use and effectiveness in making various types of requests.']}], 'highlights': ['The chapter covers building a full stack application with React, Redux, and Django, focusing on the creation of a lead manager application with authentication and user-specific access.', 'The tutorial emphasizes the use of Django rest framework, which minimizes the need for excessive code to achieve desired functionality.', 'Creating a view set allows for the creation of a full CRUD API, enabling functionalities like create, read, update, and delete without specifying explicit methods, similar to Ruby on Rails resources.', 'The chapter demonstrates creating a Django REST API with full CRUD functionality using a view set, minimizing code.']}