Django I

Django for beginner


Progress
Reviewed: 0%
8 Tasks


Course Title: Django for Beginners: Building Web Applications with Python Course Description: This beginner-level Django course is designed to provide a comprehensive introduction to web development using the Django framework in Python. Whether you're a newcomer to programming or an experienced developer looking to expand your skillset, this course will equip you with the knowledge and practical skills needed to build dynamic and interactive web applications.

Throughout the course, you'll gain a solid understanding of the fundamental concepts and components of Django, including models, views, templates, and URLs. You'll learn how to set up a development environment, configure Django projects, and leverage the power of Django's built-in features, such as authentication, forms, and databases.

Hands-on exercises and projects will be an integral part of the course, allowing you to apply your knowledge and reinforce your understanding of Django. By the end of the course, you'll have built multiple web applications from scratch, integrating features like user registration, authentication, data manipulation, and more.

Key Topics Covered: 1. Introduction to Django and web development
2. Setting up a Django development environment
3. Understanding Django's architecture and file structure
4. Creating models and working with databases
5. Implementing views and templates for dynamic web pages
6. Handling user input with Django forms
7. User authentication and authorization
8. Managing static files and media uploads
9. Deploying Django applications to a web server
10. Best practices for Django development


By the end of this Django for Beginners course, you'll have a solid foundation in Django development and be ready to embark on your own web development projects or continue exploring more advanced Django concepts. Whether you're interested in building personal projects, creating web applications for clients, or pursuing a career in web development, this course will give you the essential skills to get started.

Begin by creating a GitHub account.
1. Once you have your account, create a new repository with the name "skill_captain_django_beginner ".
2. Inside this repository, organize your daily assignments by creating a separate folder for each day's work. Name each folder "day".
3. Make sure to add your assignments to the respective day's folder to keep them organized and easily accessible.
By following these steps, you'll have a GitHub account with a repository specifically designed for your Django Beginner assignments, neatly organized by day.



  • Day 1
  • Introduction to Django

    Concept:



    Resources:



    Assignments:


    Problem Statement: Create your first Django project

    Requirements:
    1. Create python virtual environment
    2. Activate virtual environment
    3. Create django project
    4. Create app myapp and add app in INSTALLED_APPS list in settings.py
    5. Create static folder structure inside your django project. (Manually. No Django command for this. Yet :P)
    6. Run development server by using command
    7. Access the project: Open your web browser and enter the following URL: http://localhost:8000/

            
                python manage.py runserver
            
        
    Here, to run the development server you pass the runserver argument in manage.py.



  • Day 3
  • Django Templates

    Concept:



    Resources:



    Assignments:


    Problem Statement: Expand the Profile functionality

    Requirements:
    1. Add a unique constraint on name field by updating Profile model. Add additional fields (e.g., Address, Mobile Number etc.)
    2. Implement a new endpoint to retrieve a single profile by their name. Create a GET API endpoint `/profile/{name}` that accepts a path parameter representing the profile name and returns the corresponding profile object.
    3. Implement a new endpoint to update a email address. Create a endpoint `/profile/{name}/email` that accepts a path parameter for the profile name and a request body containing the updated email address. Update the email in the database and return the updated profile object.
    4. Add validations. Ensure that the required fields (e.g., name and email) are provided in the request body, and return appropriate error responses for missing or invalid data.

    Submission:
    - Submit the updated source code.
    - Include any new modifications made to existing code.
    - Include a brief document describing the changes made and any challenges faced during the assignment.



  • Day 4
  • CRUD APIs for Profile Management System

    Concept:



    Resources:



    Assignments:


    Problem Statement: Extend the Profile Management APIs

    Requirements:
    1. Create additional attributes for profile - Mobile Number, Address.
    2. Add validation to the Profile Create API to ensure that the required fields (name and email) are provided in the request body. Return appropriate error responses for missing or invalid data.
    3. Add validation to the GET Profile detail API to check that Profile exist for the given pk (primary key). Return appropriate error responses for invalid data.
    4. Extend Profile detail API to implement a new PUT API endpoint `/profiles/{pk}/` to update a name or email. Accept a path parameter for the primary key of Profile and a JSON payload in the request body containing the updated profile data. Update the name or email in the database and return the updated profile object in the API response.
    5. Extend Profile detail API to implement a new DELETE API endpoint `/profiles/{pk}` to delete a profile by their pk. Accept a path parameter representing the primary key and delete the corresponding profile data from the database. Return a success message in the API response.
    6. Add docstring for Profile detail API. Refer docstring of Profile API for the same.
    7.Write unit tests to verify the behavior of the API endpoints. Include test cases to cover different scenarios, such as creating a profile, retrieving profile data, updating profile data, and deleting a profile.

    Submission:
    - Submit the updated source code with the expanded API.
    - Include any new modifications made to existing code.
    - Include a brief document describing the changes made and any challenges faced during the assignment.



  • Day 5
  • Django Models and ORM

    Concept:



    Resources:



    Assignments:


    Problem Statement: Perform ORM queries on the Product model

    Requirements:
    1. Retrieve products ordered by price in descending order
    2. Retrieve products with a price between a specified range
    3. Retrieve products that were added within the last 7 days
    4. Retrieve products that contain a specific keyword in their name

    Submission:
    - Submit the updated source code
    - Include any new modifications made to existing code.
    - Include a brief document describing the changes made and any challenges faced during the assignment.



  • Day 6
  • Django Admin

    Concept:



    Resources:



    Assignments:


    Problem Statement: Explore Django Admin

    Requirements:
    Create a new Django model representing a Store for the products and establish a relationship between the Product and Store models. One product can have many stores. Hint: explore Django model relationships
    Add a few products and stores using the admin interface.
    Update the details of a product.
    Delete a product.
    View the list of products.

    Submission:
    - Submit the updated source code
    - Include any new modifications made to existing code.
    - Include a brief document describing the changes made and any challenges faced during the assignment.



  • Day 7
  • Django Model Relationships

    Concept:



    Resources:



    Assignments:


    Problem Statement: Create model relationships for online Bookstore

    Requirements:
    1. Create three models: Book, Author, and Genre.
    2. Define the fields for each model:
    - Book model: title (CharField), author (ForeignKey to Author model), genre (ManyToManyField to Genre model), publication_date (DateField), price (DecimalField).
    - Author model: name (CharField), birth_date (DateField), nationality (CharField).
    - Genre model: name (CharField).
    3.Create at least three instances of each model and populate them with sample data.
    4. Write Django queries to perform the following operations:
    - Retrieve all books written by a specific author.
    - Retrieve all authors of a specific genre.
    - Add a new book with its corresponding author and genres.
    - Update the price of a specific book.
    - Remove a genre from a specific book.

    (Optional)
    5. Create Django views and templates to display the book details, author information, and genre list.

    Submission:
    - Submit the updated source code
    - Include a brief document describing the changes made and any challenges faced during the assignment.



  • Day 8
  • Django Authentication and Authorization

    Concept:



    Resources:



    Assignments:


    Problem Statement: Expand Login and Register functionality

    Requirements:
    - Reuse the logic given for login_view and register APIs to create a simple web app that will have a home page, log-in, and register functionality.
    - Implement User login and register and home page templates
    - Create a Django registration form for new users to create an account.
    - Implement a login form to authenticate users.
    - Use Django's built-in authentication system to handle user authentication and sessions. - Implement a logout view to allow users to log out of their accounts.
    - On successful login, redirect to the home page.
    - Display appropriate error response on invalid username/password.
    - Add validation on the registration page. Username can't has special characters. The length of the password should be more than 8. Password should be a combination of letters and numbers, etc.



  • Day 9
  • Ecommerce project

    Concept:



    Resources:



    Assignments:


    Problem Statement: Django E-commerce Web Application Development

    Requirements:
    Create a Django project:
    - Create a new Django project with the name "EcommerceApp".
    - Set up the project structure and configure the necessary settings.

    Create a Django app:
    - Create a new Django app called "ecommerce".
    - Set up the app's models, views, and templates directories.

    Define the Product and Order models:
    Create a Django model called "Product" with the following fields:
    1. Title (CharField)
    2. Description (TextField)
    3. Price (DecimalField)
    4. Image (ImageField)

    Create a Django model called "Order" with the following fields:
    1. User (ForeignKey to the User model)
    2. Products (ManyToManyField to the Product model)
    3. Total Price (DecimalField)
    4. Created Date (DateTimeField)

    Implement product browsing and shopping cart functionality:
    - Create a view to display a list of all products.
    - Create a view to display the details of a specific product.
    - Implement functionality to add products to the shopping cart.
    - Create a view to display the contents of the shopping cart.
    - Implement functionality to remove products from the shopping cart.

    Implement user authentication and authorization:
    - Create a registration form for new users to sign up.
    - Create a login form for users to authenticate.
    - Implement a logout view to allow users to log out.
    - Only authenticated users should be able to add items to the cart and place orders.

    Implement order placement:
    - Create a view to display the order placement form.
    - Implement functionality to create an order with the selected products and calculate the total price.
    - Save the order in the database with the associated user.

    Apply styling and templates:
    - Create HTML templates for the different views using Django's template system.
    - Apply CSS styling to make the web application visually appealing.

    Test the web application:
    - Create sample products and user accounts for testing purposes.
    - Test the functionality of browsing products, adding items to the cart, and placing orders.

    Optional: Implement additional features such as order history, user profile pages, and product search functionality to enhance the e-commerce web application.
    Submit your solution with the modified code files, including explanations and any additional steps or dependencies required for the assignment.



  • Day 10
  • Tests for Ecommerce project

    Concept:



    Resources:



    Assignments:


    Problem Statement: Writing Tests for Django E-commerce Web Application

    Requirements:
    1. Write tests for product browsing and shopping cart functionality:
    - Write a test to verify that the list of products is displayed correctly on the products page.
    - Write a test to ensure that the product details page shows the correct information for a specific product.
    - Write a test to check that adding items to the shopping cart increases the cart count and updates the cart content.

    2. Write tests for user authentication and authorization:
    - Write a test to ensure that only authenticated users can access certain protected views, such as adding items to the cart or placing an order.
    - Write a test to verify that a registered user can log in successfully.
    - Write a test to verify that a logged-in user can log out successfully.

    3. Write tests for order placement:
    - Write a test to verify that an order is created with the correct products and total price when the order placement form is submitted.

    4. Write additional tests for other features:
    - Write tests to validate the functionality of additional features implemented in the e-commerce web application, such as order history, search functionality, etc

    Submit your solution with the test files, including explanations, any additional dependencies required for testing, and the document or specification containing the test cases and results.



×

Let's Go!

Congratulations on getting started. Here is a little reward for you...

×

10

Going to the next task in