# Overdue Loans Link Fix

## Problem
The "View All" link in the Overdue Loans Summary was taking users to:
```
/loans/?status=active&overdue=true
```

This showed active loans with an overdue filter, but the correct behavior should be to show loans with status "overdue".

## Solution Implemented

### 1. Updated `loans/views.py`
Added support for `status=overdue` parameter to show overdue loans directly:

```python
if status == 'overdue':
    # Show overdue loans (active loans past their due date)
    loans_list = loans_list.filter(
        loan__status='active',
        loan__due_date__lt=datetime.now()
    )
```

Also added backward compatibility for the `overdue=true` parameter:

```python
# Handle overdue parameter separately (for backward compatibility)
if overdue == 'true' and status != 'overdue':
    loans_list = loans_list.filter(
        loan__status='active',
        loan__due_date__lt=datetime.now()
    )
```

### 2. Correct URL Patterns

**Old (Incorrect):**
```
/loans/?status=active&overdue=true
```

**New (Correct):**
```
/loans/?status=overdue
```

## How to Fix Links

If you find any links in your templates that use the old pattern, update them to:

```html
<!-- Old -->
<a href="{% url 'loans:loans' %}?status=active&overdue=true">View All</a>

<!-- New -->
<a href="{% url 'loans:loans' %}?status=overdue">View All</a>
```

## Testing

Test the fix by:
1. Navigate to the loans page
2. Click on any "View Overdue Loans" or "View All" link in the overdue section
3. Verify the URL is `/loans/?status=overdue`
4. Verify only overdue loans are displayed

## Status
✅ **FIXED** - The loans view now properly handles both:
- `status=overdue` - Shows overdue loans
- `status=active&overdue=true` - Also shows overdue loans (backward compatibility)

Both URL patterns will now correctly display only overdue loans (active loans past their due date).
