2022-07-21 12:45:44 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
from django.shortcuts import render
|
|
|
|
from django.urls import reverse_lazy
|
|
|
|
from django.views import View
|
|
|
|
from django.views.generic.edit import CreateView
|
|
|
|
|
|
|
|
from core.forms import NewUserForm
|
2022-07-21 12:47:56 +00:00
|
|
|
from core.models import Plan
|
2022-07-21 12:45:44 +00:00
|
|
|
|
|
|
|
# Create your views here
|
2022-07-21 12:47:56 +00:00
|
|
|
# fmt: off
|
2022-07-21 12:45:44 +00:00
|
|
|
|
|
|
|
|
2022-07-21 12:45:57 +00:00
|
|
|
class Home(View):
|
2022-07-21 12:45:44 +00:00
|
|
|
template_name = "index.html"
|
|
|
|
|
2022-07-21 12:46:48 +00:00
|
|
|
def get(self, request):
|
2022-07-21 12:45:44 +00:00
|
|
|
return render(request, self.template_name)
|
|
|
|
|
|
|
|
|
2022-07-21 12:47:45 +00:00
|
|
|
class Billing(LoginRequiredMixin, View):
|
|
|
|
template_name = "billing.html"
|
2022-07-21 12:45:44 +00:00
|
|
|
|
2022-07-21 12:46:48 +00:00
|
|
|
def get(self, request):
|
2022-07-21 12:47:56 +00:00
|
|
|
context = {"plans": Plan.objects.all(),
|
|
|
|
"user_plans": request.user.plans.all()}
|
|
|
|
|
|
|
|
return render(request, self.template_name, context)
|
2022-07-21 12:45:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Signup(CreateView):
|
|
|
|
form_class = NewUserForm
|
|
|
|
success_url = reverse_lazy("login")
|
|
|
|
template_name = "registration/signup.html"
|