quantum-ai-v2/core/views.py
Claude bfdef5b658 Refactor: Complete architecture reorganization with proper separation of concerns
BREAKING CHANGES:
- Move marketplace and agent discovery views from core to agent_base app
- Transfer all wallet functionality from core to dedicated wallet app
- Move Stripe webhook handling to wallet app for better organization
- Consolidate payment system logic under single responsibility

NEW STRUCTURE:
- core app: Platform pages only (homepage, pricing)
- agent_base app: Complete agent marketplace and catalog system
- wallet app: Full payment system with Stripe integration
- Individual agent apps: Unchanged, self-contained

IMPROVEMENTS:
- Clean URL namespacing (agent_base:marketplace, wallet:wallet)
- Template organization by app responsibility
- Removed deprecated CSS files (header.css)
- Added utility classes (.hidden)
- Updated all template references to new URL structure
- Comprehensive CLAUDE.md documentation updates

TECHNICAL CHANGES:
- Templates moved: marketplace.html, agent_detail.html → agent_base/
- Templates moved: wallet*.html → wallet/
- New files: agent_base/views.py, agent_base/urls.py, wallet/urls.py
- Updated main urls.py routing configuration
- Fixed Django system checks and namespace conflicts
- Verified all functionality with test suite

This reorganization follows Django best practices with single responsibility
principle, making the codebase more maintainable and scalable.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 20:03:53 +05:30

29 lines
1.0 KiB
Python

from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from agent_base.models import BaseAgent
def homepage_view(request):
"""Homepage view with agent system"""
# Get featured agents for homepage
featured_agents = BaseAgent.objects.filter(is_active=True).order_by('name')[:6]
context = {
'user_balance': request.user.wallet_balance if request.user.is_authenticated else 0,
'featured_agents': featured_agents,
}
return render(request, 'core/homepage.html', context)
def pricing_view(request):
"""Pricing page for non-logged-in users"""
# If user is already logged in, redirect to wallet top-up
if request.user.is_authenticated:
return redirect('wallet:wallet_topup')
# Get sample agents to show pricing context
sample_agents = BaseAgent.objects.filter(is_active=True).order_by('name')[:4]
context = {
'sample_agents': sample_agents,
}
return render(request, 'core/pricing.html', context)