Cademy logoCademy Marketplace

Course Images

Django with Tailwind CSS

Django with Tailwind CSS

🔥 Limited Time Offer 🔥

Get a 10% discount on your first order when you use this promo code at checkout: MAY24BAN3X

  • 30 Day Money Back Guarantee
  • Completion Certificate
  • 24/7 Technical Support

Highlights

  • On-Demand course

  • 12 hours 38 minutes

  • All levels

Description

Embark on a transformative Python web development journey with this course and dive deep into creating a dynamic book rental system from scratch. Master Django's import-export capabilities, design elegant UI with Tailwind CSS, implement advanced features, and more. Elevate your skills and build real-world applications effortlessly!

Django and Tailwind CSS, the dynamic duo of web development, come together in this course. In this immersive learning experience, we blend the power of Django's robust back-end capabilities with the modern design approach of Tailwind CSS. We will be starting with the fundamentals of Python and Django. We will learn how to export data seamlessly from Django admin and views in various formats such as XLS, CSV, and JSON. Then, we will discover the art of enhancing user experience with features such as copying data to the clipboard and generating QR codes for book rentals. Followed by which, we will take a deep dive into automation by writing Linux scripts and creating custom management commands to generate dummy data. Uncover the secrets of building elegant user interfaces with Tailwind CSS, including implementing light/dark mode, and crafting reusable components. A special focus of this course is advanced authentication methods. We will explore the intricacies of adding an extra layer of security through One-Time Passwords (OTP), ensuring a robust authentication system for our applications. Delve into the nuances of Django's function views versus class-based views, empowering you to choose the right approach for every scenario. By the end of this course, we will be equipped with a robust skill set, ready to create professional web applications independently.

What You Will Learn

Create dynamic, user-friendly dashboards using Django and Tailwind CSS
Master Chart.js for interactive and visually compelling data visuals
Dive deep into Tailwind CSS for professional, responsive UI design
Explore data export formats, aggregation methods, and AJAX techniques
Automate workflows, write Linux scripts, and enhance project efficiency
Implement security measures, handle authentication issues, and more

Audience

This course caters to both aspiring and experienced web developers looking to expand their skill set in Python and Django while mastering the art of creating visually captivating web interfaces with Tailwind CSS. If you are a Python enthusiast eager to explore web development or a seasoned developer aiming to enhance your web app design and security abilities, this course is designed for you.

To fully benefit from this course, a basic understanding of Python is recommended. Familiarity with programming concepts and some exposure to web development will be advantageous.

Approach

Our course adopts a hands-on and project-based approach, emphasizing real-world applications. You will dive into building a fully-functional book rental system from scratch, providing you with practical experience and deep insights into Django, Tailwind CSS, and various web development techniques. Expect engaging projects and expert guidance, ensuring a dynamic and immersive learning experience.

Key Features

Build a book rental system using Django and Tailwind CSS * Learn data manipulation skills such as data export, QR code generation, and more * Implement user authentication with OTP security, login forms, and session management with Django

Github Repo

https://github.com/PacktPublishing/Django-with-Tailwind-CSS

About the Author

Lukasz Makinia

Lukasz Makinia is a freelance web developer and a Lean Sigma Six Black Belt. From the beginning of his 8-year professional career, he's related to the field of continuous improvement by providing IT and Lean Management solutions to medium and large companies. He also creates web applications mainly for data gathering and processing using Python/Django, JavaScript, React, and ML. In his free time, Luke writes articles for his blog-PyPlane. He is associated with 'Django Ninjas'-a web framework for building APIs with Django and Python 3.6+ type hints. They provide online educational courses mainly about Python/Django by the community of web developers across the globe. Their classes are project-based only, which means 'teaching by doing.'

Course Outline

1. Introduction

In this section, we will provide an overview of the 'Django with Tailwind CSS' course. We will gain insights into the course's key topics, including user authentication, dashboard creation, navigation features, dark and light mode switch, managing books, rentals, and automation scripts for database management. This section will also guide us on setting up our development environment using Visual Studio Code and essential extensions for Django, Python, and Tailwind CSS.

1. Course Overview

In this video, we will explore the key topics covered in this 'Django with Tailwind CSS' course. We will learn about user authentication, dashboard creation, navigation features, dark and light mode switch, managing books, rentals, and even automation scripts for database management. Ideal for ambitious beginners looking to dive deep into Django.

2. Code Editor + Extensions

In this video, we will guide you through setting up your development environment. In this course, we will be using Visual Studio Code and essential extensions for Django, Python, and Tailwind CSS.


2. Defining the Models

In this section, we will lay the foundation for your Django project by defining essential models and their relationships. Starting from setting up our development environment and creating the initial project structure, we will guide you through creating models for authors, publishers, books, customers, and rentals. We will also learn to configure media files for image handling, generate QR codes for books, and make improvements to the Book model, such as renaming the "Book ID" field to "ISBN" (International Standard Book Number) for clarity in database relationships.

1. Start a New Project

In this video, we will guide you through the process of setting up a Django development environment from scratch. We will learn how to create a virtual environment, install Django, initialize our project structure, create a super user, and run the development server, enabling you to start building your Django application.

2. Create First App and Model for Authors

In this video, we will create our first application within our Django project, named "Authors." We will start by setting up the application structure and defining a model for authors in the Django database.

3. Create Apps for: Publishers, Books, Customers, and Rentals

In this video, we will add essential applications-Publishers, Books, Customers, and Rentals-to our Django project, setting the foundation for our upcoming work.

4. Create the Publisher Model

In this video, we will create a database model for publishers. We define fields such as name, country, created, and updated for the Publisher model, and demonstrate how to make specific fields editable in the Django administration.

5. Create the Book Model + Override the Save Method to Generate the Slug

In this video, we will set up the models for our books application in a Django with Tailwind CSS course. The video covers defining two models: "Book Title" and "Book" with their respective fields and relationships.

6. Generating Book ID with UUID

In this video, we will focus on generating unique book IDs using UEID and explore the difference between UEID and hashing for generating identifiers. The video also presents a challenge to implement this functionality in a Book model.

7. Add ImageField to the Book Class + Configure Media Files

In this video, we will learn about configuring media files and setting up the necessary components for handling image uploads in a web application. The video covers defining an image field, installing the Pillow library for image processing, configuring media file settings, and accessing uploaded media files through URLs. The video provides a practical demonstration of these concepts in the Django project.

8. Create QR Code for the Book

In this video, we will learn how to generate QR codes for books in a Django project. The video covers the process of deleting an incorrect image, installing the necessary QR code library, and writing Python code to generate QR codes based on book titles.

9. Create the Customer Model

In this video, we will learn how to create a Customer model in the models.py file. The Customer model includes fields for the first name, last name, and a unique username. Additionally, it covers setting optional fields for additional information and customer rating.

10. Create the Rental Model

In this video, we will learn how to create a model for tracking rented books by customers. The video covers defining a rental model with fields for the book, customer, rental status, rent start date, rent end date, return date, and whether the rental is closed.

11. Improvements to the Book Model

In this video, we will be making small changes to our book model by renaming the "Book ID" field to "ISBN" (International Standard Book Number) to avoid confusion in our database relationships.


3. Introduction to Django MVT Architecture

In this section, we will dive into the fundamentals of Django's Model-View-Template (MVT) architecture, which forms the backbone of Django web applications. Starting with an introduction to MVT, we will explore how models represent database tables, views handle user requests, and templates define data presentation. We will then progress to practical application, covering topics such as creating views, implementing templates, mastering template inheritance, working with querysets, and optimizing code organization.

1. Introduction to MVT

In this video, we will provide a brief introduction to the Django Model-View-Template (MVT) architecture. You will learn how models represent database tables, views handle user requests and data retrieval, and templates define data presentation to users. This foundational understanding sets the stage for building Django applications effectively.

2. Writing Our First View

In this video, we will demonstrate how to create a basic view for the main page of our Django application. You will learn how to define a simple function view that returns an HTTP response, paving the way for more complex views and template rendering in the upcoming videos.

3. View with the Template

In this video, we will enhance our home view by implementing template rendering in Django. We will learn how to configure Django to use templates, create a basic HTML template, and pass variables from the view to the template for dynamic content display.

4. Template Inheritance

In this video, we will delve into the powerful concept of template inheritance in Django. We will learn how to create a base HTML template that can be inherited by other templates, allowing us to build a consistent layout for our web application while customizing content for each page effortlessly.

5. Working with querysets

In this video, we will retrieve data from a database using Django's query set API and display it in our template. We will focus on retrieving data from the "Customer" model and displaying it in an HTML template.

6. Reverse Relationships

In this video, we will explore how to establish and utilize reverse relationships in Django models to retrieve all books associated with a specific book title.

7. Defining Methods in Models

In this video, we will learn how to optimize code organization by moving logic to the models.py file. The video covers defining a method to retrieve all the books associated with a given book title and demonstrates how to use the property decorator to treat the method as a field.

8. Better Code Organization

In this video, we will explore how to organize URL patterns and templates in Django applications for a cleaner and more structured codebase. Learn how to avoid URL pattern and template mess by creating separate URL py files and using app-specific template directories.

9. App Views and URLs

In this video, we will be applying the concepts learned in the previous video. We will learn how to create views for displaying a list of book titles and the details of a specific book title in our Django web application.

10. Navigating Between Views

In this video, we will learn how to navigate between pages in our books application. We will make a specific item a link that, when clicked, takes us to the book title detail page. Additionally, we will add a back button to return to the main page.


4. Exporting Data from the Admin

In this section, we will explore the process of exporting data from the Django administration interface into various formats, such as Excel, CSV, and JSON. Additionally, we will dive into customizing the export functionality for different models like publishers, customers, and books. Finally, we will address issues related to code structure and improve the admin interface by adjusting the header and title.

1. Dummy Data Generation with Custom Management Commands

In this video, we will focus on exporting data from our Django administration into different formats, such as Excel, CSV, or JSON. Before doing that, we will generate dummy data for authors, publishers, book titles, books, and customers using custom management commands.

2. Exporting the Publisher Data

In this video, we will learn how to install Django Import-Export and implement export functionality from the Django administration for the publisher models. We will also customize the export format.

3. Exporting Customers Data

In this video, we will learn how to add export functionality from the Django administration for customer data, including their additional information and book ISBNs. We will also see how to format the additional information and ISBNs for better readability in the exported CSV file.

4. Exporting Books Data

In this video, we will explore how to export models from the Django administration, focusing on the Book class example. We will cover exporting fields such as title, status, publisher, ISBN, and QR code, and make adjustments to display the status in a more user-friendly way.

5. Improving the Book Exports

In this video, we will address a circular import issue between the Rentals and Books applications by reorganizing the code structure and resolving import errors.

6. Adjust Admin Header and Title

In this video, we will adjust the admin header and title for Django administration and site administration.


5. First Steps with Tailwind and Django CBV on the Book App

In this section, we will embark on a comprehensive journey into Django development enriched with the styling capabilities of Tailwind CSS. From setting up the fundamentals of Tailwind CSS to diving into Django forms, advanced view optimizations, and creating reusable components, each video unlocks a new dimension of web development. Enhance your Django skills while mastering the art of responsive design and user interaction.

1. Introduction to Tailwind CSS

In this video, we will explore the fundamentals of web development using Django with Tailwind CSS. We will cover the core concepts behind Tailwind CSS and how it simplifies the process of styling websites and web applications. Get ready to dive into the world of efficient web design!

2. Add Tailwind CSS to a Django Project

In this video, we will install Tailwind CSS for our Django project using the Django Tailwind package. We will walk through the installation steps and set up the initial configuration.

3. Add Custom Color

In this video, we will learn how to create custom color classes in Tailwind CSS and apply them to change the background color. We will demonstrate how to define and use custom colors for a more personalized design.

4. Light / Dark Mode

In this video, we will learn how to add functionality for toggling between dark mode and light mode in a web application using Django and Tailwind CSS.

5. Style Button

In this video, we will learn how to style a button using Tailwind CSS and add icons from Font Awesome to indicate different modes. The button will switch between light and dark modes, with icons representing the sun and moon, making it more user-friendly.

6. Add Navbar and Sidebar

In this video, we will add a navbar and sidebar to our project, focusing on the layout and initial styling. The video covers creating and including the necessary HTML templates for the navbar and sidebar.

7. Transforming the Book Title List to Class View

In this video, we will dive into class-based views in Django, transitioning from function-based views. We will create a simple "Book Title List View" using class-based views, simplifying our code, and improving readability.

8. Overriding get_queryset Method

In this video, we will explore advanced techniques for optimizing Django views. We will learn how to override the get_queryset method, manipulate parameters from the URL, and apply custom filtering to efficiently retrieve and display data. Stay tuned to enhance your Django development skills!

9. Create First Django Form

In this video, we will explore how to create forms in Django, focusing on using Django forms for more efficient development. The video covers creating a book title form and integrating it into a webpage.

10. Form Methods

In this video, we will dive deep into Django forms, exploring topics such as configuring forms, handling form submissions, setting up success URLs, and implementing advanced functionality. Follow along as we troubleshoot errors, work with classes and methods, and create a seamless user experience.

11. Form Validation

In this video, we will explore advanced form validation techniques in Django. Learn how to handle form errors, validate input lengths, and check for existing database entries. Discover the process of raising validation errors and displaying field-specific error messages.

12. Styling Options for the Forms

In this video, we will explore different methods for styling Django forms. We will delve into using Django widget tweaks and demonstrate how to individually style form fields in templates. Watch as we customize form elements, applying colors, padding, and rounded edges to create visually appealing Django forms.

13. Styling the Book Title Form

In this video, we will create a base form template using Django and Tailwind CSS. Starting from scratch, we will style the form elements, ensuring a clean and professional look. We will address specific field-related errors and demonstrate how to handle them effectively, providing you with a solid foundation for your Django projects.

14. Django Messages

In this video, we will learn how to handle notifications for successful object creation and errors, such as short titles. We will explore displaying messages for different validation outcomes, guiding you through the process step by step. Discover the essentials of effective user feedback.

15. Reusable Components - Alert

In this video, we will explore the process of styling messages in Django applications. We will create reusable alert components, differentiating between info alerts for successful operations and error alerts for form submission issues. Learn how to customize the appearance of these alerts and enhance the user experience in your Django projects.

16. Reusable Components - Header

In this video, we will create a reusable header component for our application, focusing on design elements such as gradient background and text styling. This component will be used across various sections, providing a cohesive look and feel to our project.

17. Get Context Data Method

In this video, we will learn how to pass additional data to a template in Django. We will explore different methods, such as overriding the get_context_data method and using keyword arguments to add custom data to the template.

18. Adding Extra Parameter to the Book Title List View

In this video, we will explore how to list book titles from A-Z, allowing users to click on specific letters to see corresponding titles. Each letter selection displays book titles starting with that letter. If there are no titles for a selected letter, it will be indicated.

19. Configuring Static Files (Add JavaScript)

In this video, we will learn how to integrate static files into your Django project. Using JavaScript as an example, we will demonstrate how to configure and organize static files within your applications. From configuring the settings to attaching the JavaScript files to your templates, you will gain a solid understanding of managing static assets effectively in Django.

20. Add a Button to the Header

In this video, we will learn how to dynamically display buttons in Django forms based on form availability. You will understand the process of implementing interactive buttons triggered by form existence, enhancing user experience in your Django applications.

21. Place Form in a Model

In this video, we will dive into integrating Django models and forms, setting up a seamless system for adding new book titles. We will learn the intricacies of the integration process, enhancing our understanding of Django development.

22. Adding js to the Model + Fixing the Form

In this video, we will learn how to create interactive forms. The video covers topics such as displaying and hiding a form model on button clicks, handling cancel actions, and implementing a backdrop to hide the form when clicking outside of it.

23. Book List View

In this video, we will modify the book title detail view, allowing users to see all available books and their rental statuses. Using class-based views, we will create a book list view, ensuring a smooth transition from the book title detail view.

24. Adding Pagination

In this video, we will explore a straightforward method to implement pagination in our web applications. Discover how to seamlessly navigate through multiple records, enhancing user experience and streamlining content accessibility. Learn the art of efficient data presentation without the hassle.

25. Transforming to Book Title Detail View

In this video, we will delve into advanced techniques for creating a book title detail view in Django. Learn how to utilize model methods effectively, enhancing your application's functionality. Explore the intricacies of context naming and object iteration, ensuring seamless integration of detailed data.

26. Add a Header to the Book Title Detail Page + Back Button

In this video, we will focus on improving user interaction by adding a dynamic header to our book title detail page. Learn how to integrate JavaScript to create a responsive 'Go Back' button, enhancing navigation for a seamless user experience.

27. Add Table to Display Books

In this video, we will learn how to create a stylish table to display books in a visually appealing manner. The table design, including incremental numbering, book titles, QR codes, and status indicators, is demonstrated. Additionally, the video covers navigation to individual book details and the option to delete specific books, providing a comprehensive overview of managing book data effectively.

28. Book Detail Page (Get Absolute URL)

In this video, we will explore the intricacies of accessing specific books by implementing a detailed view. By clicking on the selection, viewers will learn how to navigate through various books, understanding the process from coding in Visual Studio Code to creating corresponding templates.

29. Book Delete Page

In this video, we will explore the process of implementing the delete functionality for objects in a Django application. The video guides viewers through the steps of setting up a delete view in Visual Studio Code, defining a class for deleting books, and creating a confirmation page where users can confirm or cancel their deletion choice. The video also covers the important concept that deletion is permanent and cannot be undone.

30. Add Confirmation of Delete

In this video, we will learn how to add a notification that confirms the deletion of a book in a Django web application. The video covers adding a success message and integrating it into the book deletion process.

31. Reusable Components - Buttons

In this video, we will explore the implementation of reusable components for selecting and deleting objects in a Django web application. By focusing on the concept of reusable components, we will create select and delete buttons, enhancing user interaction within the interface.

32. Checking Whether the Book Is Available

In this video, we will explore how to determine the availability of books in a Django application. We delve into coding methods to check whether a book is available for rent, considering various rental statuses. Learn how to visually represent book availability using Font Awesome icons in your web application interface.

33. Display the Status of the Book

In this video, we will deep dive into managing book statuses within a Django application. We will fix issues related to color coding, ensuring accurate representation of book availability. Explore how status changes dynamically based on rental information and learn how to display custom messages for various scenarios.

34. Book Detail Page

In this video, we will work on the book detail page, focusing on implementing various features such as displaying book details, managing availability status, generating QR codes, and adding buttons for changing status and viewing rental history.

35. Adding Copy to Clipboard

In this video, we will learn how to implement copy-to-clipboard functionality for book IDs. We will use JavaScript to create an event listener for a copy button, allowing users to easily copy and paste book IDs. This feature enhances user experience and streamlines data handling on the website.


6. Working on the Rentals App

In this section, we will focus on enhancing the rentals management functionality of our web application. We will cover topics such as adding the Rentals section to the sidebar, creating search functionality by book ID, highlighting the current section in the sidebar, customizing the book model, automating tasks, and improving the user experience with advanced features such as rental status updates, adding new rentals, and downloading rental data in various formats.

1. Add Rentals Section + Create First View and Template

In this video, we will delve into the new section called Rentals. We will start by adding this section to our sidebar and focus on functionalities such as changing book status and viewing rental history. The main highlight will be the creation of a search book view, allowing users to retrieve the entire rental history of a specific book by entering its ID.

2. Highlight the Current Section in the Sidebar

In this video, we will learn how to highlight different sections of our web application based on the current page. We will focus on changing the color of the navigation links based on the active page, making it easier for users to identify where they are within the application.

3. Add Search Functionality by the Book ID - Form and View

In this video, we will delve into creating a dynamic search functionality for our book application. Through Django forms and views, we will construct a search form allowing users to query books by their unique IDs or ISBNs. We will learn how to handle form submissions, validate book existence, and redirect users to detailed rental information seamlessly.

4. Add Search Functionality by the Book ID - Template and JavaScript

In this video, we will style the search rentals page and add JavaScript functionality for submitting the form when entering the book ID or ISBN. Learn how to integrate dynamic interactions into your Django web applications.

5. Redirect to Rentals List

In this video, we will create the book rentals page, allowing us to view the rental history of a particular book based on its ID. We will set up the necessary views and templates for this feature.

6. Display the History of Rentals

In this video, we will dive into the rental history page, focusing on customizing query sets and context data methods. You will learn how to filter rental objects by specific book IDs, display customer usernames, ISBNs, rental statuses, start and end dates, and more.

7. Writing Custom Template Filter to Retrieve Status Information

In this video, we will address the issue of displaying status values in a Django application. The video covers how to convert database values into human-readable names using Django filters and template tags.

8. Introduction to Book Model Modification

In this video, we will explore modifications to the book model in our Django application. The focus will be on transforming the ISBN into a unique identifier based on book title and publisher name. We will delve into the changes needed for the ID field and create a hash string for ISBN, allowing more accurate and efficient book searches.

9. Change pk to UUID

In this video, we will delve into customizing Django models by focusing on the ID field. By overriding the ID with a unique char field, we will create a distinctive 36-character string identifier (UEID) for each entry. The process involves setting primary key and max length, ensuring seamless integration in the database.

10. Change ISBN as Hashed Book Title and Publisher (sha 256)

In this video, we will explore the process of generating unique ISBNs for books in Django. We will create a utility function called hashbookinfo to combine book titles and publisher names and hash them using SHA-256 to ensure unique ISBNs. Watch as we implement this functionality and test it with different book entries.

11. Automation - Run Migrations

In this video, we will delve into automation in Django development. First, we will correct a small issue in our view. Then, we will explore creating shell scripts for automation, demonstrating how to fix permission issues and automate tasks using both Linux and Python scripts. Finally, we will automate database migrations and server run commands. Join us for a hands-on journey into Django automation!

12. Automation - Reset Data

In this video, we will explore advanced database operations in Django. We will create a shell script to reset migrations, remove the database, run migrations, create a superuser, and generate dummy data, streamlining complex database management tasks.

13. Modification: Display the Book ID and ISBN

In this video, we will learn how to display unique book IDs and hashed ISBNs based on book titles and publisher names. The video covers fixing display issues for book titles, implementing proper error messages for non-existent books, and enhancing the search functionality.

14. Search by Book ID or ISBN

In this video, we will enhance the search functionality of our Django application. We will delve into advanced search queries, exploring both ID and ISBN searches. Learn how to modify the query set, implement search logic, and navigate complex book references effortlessly.

15. Last Touches to Book Detail Page

In this video, we will dive into Django's powerful features, updating the book rental status seamlessly. We will explore how to change ISBN to ID, modify buttons for dynamic actions, and create a view to update rental statuses.

16. Working on Update Rental Status

In this video, we will finalize our rental status update page in Django. Starting from adding a header and a submit button, we will style the form elements and implement functionality to update the rental status. We will learn how to handle form submissions, set success messages, and navigate users to the rental history view after a successful status update.

17. Add Small Improvements

In this video, we will implement two key improvements to our application. Firstly, we will ensure that the status of a rental can only be updated if it's not closed, preventing unauthorized changes. Secondly, we will enhance the display of rental statuses in the admin interface, ensuring accurate representation.

18. Add New Rental

In this video, we will create a rental functionality, allowing customers to rent books. The video covers implementing a button on the book details page, enabling users to rent available books, updating the rental status, and handling multiple book instances.

19. Add Header to the New Rental Page

In this video, we will add a header to our new rental page and dynamically display the book ID in the description. Learn how to integrate components and enhance user experience seamlessly.

20. Download Rentals Data from View - Part 1

In this video, we will implement a functionality to download rental objects directly from the application section, allowing users to choose from various formats such as CSV, XLS, or JSON. Learn how to integrate a download button and enable users to download data seamlessly.

21. Download Rentals Data from View (And Admin) - Part 2

In this video, we will complete the download functionality for rentals. The video covers creating a header in the HTML template, handling form submissions, converting format choices to a dictionary, and configuring the admin interface to export rental data using Django's export action mixing.


7. Styling the Navbar

In this section, we will enhance the user experience of our website's navigation bar. First, we will generate dynamic avatars using Jdenticon based on usernames, adding a personal touch. Next, we will create a sleek dropdown menu featuring user options and a logout feature. Finally, we will add JavaScript to make the menu interactive, allowing it to appear on click and disappear gracefully, while also exploring event listeners and icon customization for an engaging web design.

1. Adding Jdenticon to the Navbar

In this video, we will generate avatars dynamically using Jdenticon based on usernames. By integrating Jdenticon into our navigation bar, we will create unique and visually appealing avatars without relying on user-uploaded images. We will delve into adjusting the width, height, and styling to achieve a polished look. This seamless customization adds a personal touch to user profiles.

2. Create the Dropdown Menu

In this video, we will create a button with a dropdown menu, enhancing our website's user interface. The dropdown includes options for the user's username and a logout feature. Stay tuned to improve your web design skills!

3. Adding JS to the Navbar to Make It More Interactive

In this video, we will demonstrate how to add interactivity to a menu using JavaScript. We will learn to create a dropdown menu that appears when clicked and disappears when clicked again or when the cursor is moved away. The video covers implementing event listeners, toggling classes, and dynamically changing menu icons, providing a comprehensive understanding of interactive web design.


8. Dashboard and Authentication (Including OTP)

In this section, we will dive into creating a dynamic dashboard, leveraging Ajax for seamless data integration. Additionally, we will explore user authentication with features like one-time passwords (OTP), mixins, decorators, and fine-tuning the user interface for a polished web experience.

1. Create the Dashboard Page

In this video, we will create a dashboard view and a separate chart data view. We will load data to JavaScript and display "Hello world chart data" in the template view.

2. Add Ajax

In this video, we will retrieve a message, "Hello World Chart Data View," from our chart data view. Using jQuery's Ajax method, we fetch the data and dynamically modify our dashboard's HTML content to display the message, demonstrating how to integrate data into web applications seamlessly.

3. Aggregate Versus Annotate

In this video, we will explore how to use the aggregate and annotate methods to prepare chart data for analysis. We will learn how to calculate summary statistics for the entire query set using aggregate and create summaries for each object in the query set using annotate.

4. Prepare Chart Data - Part 1

In this video, we will prepare the actual chart data for our project. We start by organizing book titles versus books, counting the number of books for each title. The video guides you through the process of structuring and analyzing the data, essential for creating meaningful visualizations.

5. Prepare Chart Data - Part 2

In this video, we will cover two main topics. First, we will examine the status of books, categorizing them as "Rented" or "Returned." We will then explore the comparison between the number of customers and publishers.

6. Add Chart js

In this video, we will learn how to create dynamic charts based on data. We will explore chart.js and integrate it into our web application. Through step-by-step instructions, we will understand how to draw charts, handle data, and customize the presentation.

7. Adding Forms for Logging In

In this video, we will create essential forms for user authentication, including login and one-time password (OTP) forms. Starting with the core project folder, we will develop login and OTP forms using Django, ensuring seamless user authentication.

8. Add Login View

In this video, we will implement the login view for our user authentication system. Utilizing the login form and OTP form created earlier, we will delve into the Django views to handle form instantiation, form validation, and user authentication.

9. Add Login Template

In this video, we will focus on designing the login page for our Django application. We will create an HTML template for the login form, and style it, using Tailwind CSS, and ensure proper error handling for invalid login attempts.

10. Create Send OTP Function

In this video, we will delve into the world of one-time passwords (OTP) by installing PyOTP, a Python library. We will create a helper function named 'send_otp' that generates and sends OTPs for authentication. Follow along as we explore the intricacies of time-based one-time passwords, providing an essential layer of security to your applications.

11. Create OTP View

In this video, we will implement the OTP (One Time Password) view, enabling users to input their OTP after submitting login credentials. We will cover handling OTP validation, session management, and error messaging, ensuring a seamless user experience.

12. OTP Template and Test Run

In this video, we will focus on implementing OTP (One Time Password) verification in a Django web application. We will cover creating and styling the OTP HTML form, ensuring the proper validation and expiration of OTPs, and testing the login functionality.

13. Add Logout

In this video, we will focus on implementing the logout functionality in our Django web application. We will create a logout view, set up the corresponding URL, and ensure that users can securely log out of the system.

14. Adding Mixins and Decorators for Login

In this video, we will cover the essential topic of adding mixins and decorators for user authentication. Learn how to implement login required mixins and decorators to secure your Django web application effectively, ensuring that your views are accessible only to authorized users.

15. Display Contents Depending on If User Is Authenticated

In this video, we will explore how to conditionally display elements such as the sidebar, navbar, menu, jdenticon, and theme switch based on user authentication status. Learn how to implement dynamic UI components for a seamless user experience in your web application.

16. Chart Data Only for Ajax Requests

In this video, we will address security concerns by implementing conditional checks to restrict access to JSON data, ensuring that the "Chart data" is only accessible for Ajax requests. By doing so, we will prevent unauthorized users from accessing sensitive information. Additionally, we will explore various fixes and enhancements to further improve the application's security and functionality.

17. Fix Change Theme After Login

In this video, we will address a bug related to the light and dark mode switch. Specifically, we will fix an issue where the switch doesn't work properly after logging in and out. We will dive into the code and debug the problem to ensure smooth functionality for users switching between light and dark modes.

18. Put Charts into Cards and Set the Dashboard Header

In this video, we will enhance the visual appeal of our charts by encapsulating them in sleek, responsive cards. Utilizing Tailwind CSS, we will craft these cards with defined borders, shadows, and color schemes, ensuring an aesthetically pleasing design for both light and dark modes.

19. Add About Page + Highlighting for About and Dashboard Section

In this video, we will add an about page to our sidebar, addressing the empty space issue. Additionally, we will fix the highlighting on the dashboard, ensuring proper navigation highlighting for a seamless user experience.

20. Add Logo

In this video, we will guide you through the process of adding a custom logo to our website's navigation bar. Learn how to integrate a logo into your project, creating a professional and personalized touch to your site's design.

21. Add Missing Titles to Templates

In this video, we will address title inconsistencies in various templates of a Django project. We will fix issues such as double separators and missing titles, ensuring a cohesive and polished user experience across different pages.


9. Bonuses

In this section, we will dive into bonus content that enhances our Django expertise. In the section, we will explore advanced authentication customization techniques.

1. Switching Username to Email in Django Authentication

In this video, we will explore customizing Django authentication by switching the username authentication field to email. We delve into options such as Abstract User and Abstract Base User, demonstrating how to create a custom User class inheriting from Abstract User. We will modify the models.py file, set email as the unique identifier, and adjust the login and OTP views to authenticate users using email. This customization enhances control over user authentication in Django applications.

Course Content

  1. Django with Tailwind CSS

About The Provider

Packt
Packt
Birmingham
Founded in 2004 in Birmingham, UK, Packt’s mission is to help the world put software to work in new ways, through the delivery of effective learning and i...
Read more about Packt

Tags

Reviews