```python
from django.shortcuts import render
from django.http import HttpResponseNotFound
import os

# Define the view for the directory listing
def directory_listing(request, dir_path):
    # Get the full path to the directory
    full_path = os.path.join(os.getcwd(), dir_path)

    # Check if the directory exists
    if os.path.isdir(full_path):
        # Read the contents of the directory
        files = os.listdir(full_path)

        # Create an array to hold the nested list data
        list_data = []

        # Iterate over each file/folder in the directory
        for file in files:
            # Construct the full path to the file/folder
            file_path = os.path.join(full_path, file)

            # Check if the item is a directory
            if os.path.isdir(file_path):
                # Recursively call this function to get the nested list of the subdirectory
                sub_list = get_nested_list(file_path)

                # Add the nested list data to the current item
                list_data.append({'name': file, 'type': 'directory', 'items': sub_list})
            else:
                # Add the file data to the current item
                list_data.append({'name': file, 'type': 'file'})

        # Render the HTML template with the nested list data
        return render(request, 'list.html', {'dir_path': dir_path, 'list_data': list_data})
    else:
        # If the directory does not exist, return a 404 error
        return HttpResponseNotFound('<h1>Directory not found</h1>')

# Define the function to recursively get the nested list of a directory
def get_nested_list(dir_path):
    # Read the contents of the directory
    files = os.listdir(dir_path)

    # Create an array to hold the nested list data
    nested_list = []

    # Iterate over each file/folder in the directory
    for file in files:
        # Construct the full path to the file/folder
        file_path = os.path.join(dir_path, file)

        # Check if the item is a directory
        if os.path.isdir(file_path):
            # Recursively call this function to get the nested list of the subdirectory
            sub_list = get_nested_list(file_path)

            # Add the nested list data to the current item
            nested_list.append({'name': file, 'type': 'directory', 'items': sub_list})
        else:
            # Add the file data to the current item
            nested_list.append({'name': file, 'type': 'file'})

    # Return the nested list data
    return nested_list
```
```python
from django.shortcuts import render
from django.http import HttpResponseNotFound
import os

# Define the view for the directory listing
def directory_listing(request, dir_path):
    # Get the full path to the directory
    full_path = os.path.join(os.getcwd(), dir_path)

    # Check if the directory exists
    if os.path.isdir(full_path):
        # Read the contents of the directory
        files = os.listdir(full_path)

        # Create an array to hold the nested list data
        list_data = []

        # Iterate over each file/folder in the directory
        for file in files:
            # Construct the full path to the file/folder
            file_path = os.path.join(full_path, file)

            # Check if the item is a directory
            if os.path.isdir(file_path):
                # Recursively call this function to get the nested list of the subdirectory
                sub_list = get_nested_list(file_path)

                # Add the nested list data to the current item
                list_data.append({'name': file, 'type': 'directory', 'items': sub_list})
            else:
                # Add the file data to the current item
                list_data.append({'name': file, 'type': 'file'})

        # Render the HTML template with the nested list data
        return render(request, 'list.html', {'dir_path': dir_path, 'list_data': list_data})
    else:
        # If the directory does not exist, return a 404 error
        return HttpResponseNotFound('<h1>Directory not found</h1>')

# Define the function to recursively get the nested list of a directory
def get_nested_list(dir_path):
    # Read the contents of the directory
    files = os.listdir(dir_path)

    # Create an array to hold the nested list data
    nested_list = []

    # Iterate over each file/folder in the directory
    for file in files:
        # Construct the full path to the file/folder
        file_path = os.path.join(dir_path, file)

        # Check if the item is a directory
        if os.path.isdir(file_path):
            # Recursively call this function to get the nested list of the subdirectory
            sub_list = get_nested_list(file_path)

            # Add the nested list data to the current item
            nested_list.append({'name': file, 'type': 'directory', 'items': sub_list})
        else:
            # Add the file data to the current item
            nested_list.append({'name': file, 'type': 'file'})

    # Return the nested list data
    return nested_list
```