Skip to content

Haroonhsa007/LinkedIn-Django-Essential

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkedIn-Django-Essential



Start Coding with Django

Welcome to the Start Coding with Django repository. This project contains all the code examples, challenges, and course materials from a comprehensive Django course. In this course, you learn how to build full-featured Django applications—from setting up a project to implementing authentication, CRUD operations, dynamic web pages, and much more.


Table of Contents

Introduction

Django is an open-source web framework that lets you build robust web applications quickly and securely with minimal code. This course covers:

  • Rapid application development with Django.
  • Built-in security features and user authentication.
  • Creating and managing dynamic webpages and database-driven applications.
  • Utilizing Django’s admin interface, ORM, class-based views, and forms for validation.

Prerequisites

  • Python 3.8+ – A virtual environment is recommended.
  • Django 3.2+ – Although this course was built with Django 3.2, later versions are supported.
  • A code editor (e.g., VS Code) and a modern browser.
  • Basic understanding of HTTP and web development concepts.

Course Outline

1. Introduction to Django

  • Overview of Django’s philosophy: simplicity, rapid development, and security.
  • Why Django is a preferred framework for building web applications.

2. Starting Your Django Project

  • Using django-admin startproject to create a new project.
  • Project structure: manage.py, settings, URLs, and initial configurations.

3. Django Built-In User Management

  • Exploring Django’s admin interface.
  • Creating and managing users, and applying database migrations.
  • Implementing signup, login, and password management.

4. Interacting with Databases using Django ORM

  • Defining models to represent database tables.
  • Running migrations and using the Django shell.
  • Challenge: Adding a "likes" field to a note model.

5. Building Dynamic Webpages

  • Creating views that render HTML using Django’s template language.
  • Implementing loops, conditionals, and variable interpolation.
  • Using class-based views for list and detail pages.
  • Challenge: Filtering and displaying popular notes.

6. Building Robust Front-Ends

  • Managing static files (CSS, JavaScript, images) in Django.
  • Creating a base template for consistent styling.
  • Using Bootstrap to enhance design and layout.
  • Dividing templates into reusable parts using the include tag.

7. Django Forms and Validation

  • Implementing forms for creating, updating, and deleting data.
  • Adding server-side validation with custom error messages.
  • Ensuring secure form submissions with CSRF tokens.
  • Challenge: Custom validation to accept only notes about Django.

8. Working with Existing Data (CRUD)

  • Updating and deleting records using UpdateView and DeleteView.
  • Integrating function-based views for custom actions (e.g., upvoting notes).
  • Challenge: Adding a like button that updates note data securely.

9. User-Specific Data and Sharing

  • Associating notes with users via foreign keys.
  • Overriding querysets to display data for the logged-in user only.
  • Challenge: Marking notes as public or private and generating shareable links.

10. Login, Logout, and Signup

  • Customizing authentication views and templates.
  • Implementing a navigation bar that reflects the user's login state.
  • Adding signup functionality and integrating redirection after login.
  • Challenge: Creating a share link for public notes that works for both authenticated and unauthenticated users.

11. Conclusion and Next Steps

  • Recap of what you’ve built and learned.
  • Next steps: Exploring unit testing, Django REST framework, and advanced Django topics.

Installation

To set up the project locally:

# Clone the repository
git clone https://github.com/yourusername/your-django-repo.git
cd your-django-repo

# Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install Django (and other dependencies if needed)
pip install django

# Apply database migrations
python manage.py migrate

# Create a superuser for the admin interface
python manage.py createsuperuser

# Run the development server
python manage.py runserver

Usage

  • Admin Interface: Visit http://127.0.0.1:8000/admin to manage users and view models.
  • Notes App: Navigate through the various endpoints to:
    • Create, update, and delete notes.
    • Toggle between public and private notes.
    • Share public notes via generated links.
  • Authentication: Use the custom login, logout, and signup pages to secure your application.

Challenges

Throughout the course, several hands-on challenges help solidify your understanding:

  • Adding a Like Feature: Extend your note model with a “likes” field and update it via a POST request.
  • Filtering Popular Notes: Use Django’s QuerySet methods to display notes that meet specific criteria.
  • Template Modularization: Break down your HTML into reusable components using include.
  • User-Specific Data: Ensure that each user only sees their own notes by customizing the QuerySet in class-based views.
  • Public vs. Private Notes: Implement a toggle for notes’ visibility and secure public sharing.

Feel free to explore these challenges further or add your own enhancements.


License

This project is licensed under the MIT License. See the LICENSE file for details.


About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors