forked from uncloud/uncloud
amal
b7aa1c6971
- Implement a complete cycle for buying a Matrix Chat Host - Refactor the Payement cycle and stripe related methods
23 lines
No EOL
875 B
Python
23 lines
No EOL
875 B
Python
from django.views.generic.base import TemplateView
|
|
from django.contrib import messages
|
|
from django.shortcuts import redirect
|
|
|
|
from uncloud_pay.selectors import get_balance_for_user
|
|
from .forms import UserDeleteForm
|
|
|
|
class UncloudIndex(TemplateView):
|
|
template_name = "uncloud/index.html"
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
if self.request.user.is_authenticated:
|
|
context['balance'] = get_balance_for_user(self.request.user)
|
|
context['delete_form'] = UserDeleteForm(instance=self.request.user)
|
|
return context
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
UserDeleteForm(request.POST, instance=request.user)
|
|
user = request.user
|
|
user.delete()
|
|
messages.info(request, 'Your account has been deleted.')
|
|
return redirect('uncloudindex') |