35217-vm/core/views.py
Flatlogic Bot 9c79583ade Auto task
2025-10-25 07:58:42 +00:00

42 lines
1.6 KiB
Python

import os
import platform
from django import get_version as django_version
from django.shortcuts import render
from django.urls import reverse_lazy
from django.utils import timezone
from django.views.generic.edit import CreateView
from .forms import TicketForm
from .models import Ticket
def index(request):
"""Render the main dashboard with wallet and transaction data."""
# Mock data for the wallet and transactions
wallet_data = {
'balance_btc': 0.00123456,
'balance_usd': 50.12
}
transactions_data = [
{'id': 'a1b2', 'description': 'Automated Task Reward', 'amount_btc': 0.00005, 'type': 'credit', 'timestamp': '2025-10-25 10:00:00'},
{'id': 'c3d4', 'description': 'Strategy Execution Fee', 'amount_btc': -0.000005, 'type': 'debit', 'timestamp': '2025-10-25 09:30:00'},
{'id': 'e5f6', 'description': 'Automated Task Reward', 'amount_btc': 0.00007, 'type': 'credit', 'timestamp': '2025-10-24 18:00:00'},
{'id': 'g7h8', 'description': 'VIP ★2 Upgrade', 'amount_btc': -0.0005, 'type': 'debit', 'timestamp': '2025-10-24 12:00:00'},
{'id': 'i9j0', 'description': 'Initial Deposit', 'amount_btc': 0.001, 'type': 'credit', 'timestamp': '2025-10-23 20:15:00'},
]
context = {
"wallet": wallet_data,
"transactions": transactions_data,
"project_name": "AutoTask",
}
return render(request, "core/index.html", context)
class TicketCreateView(CreateView):
model = Ticket
form_class = TicketForm
template_name = "core/ticket_create.html"
success_url = reverse_lazy("home")