views.py 1017 Bytes
Newer Older
BERJON Matthieu's avatar
BERJON Matthieu committed
1
from django.contrib.auth.forms import UserCreationForm
BERJON Matthieu's avatar
BERJON Matthieu committed
2
from django.shortcuts import render
BERJON Matthieu's avatar
BERJON Matthieu committed
3
4
from django.urls import reverse_lazy
from django.views import generic
BERJON Matthieu's avatar
BERJON Matthieu committed
5

6
from django.contrib.auth.models import User
7
from .models import Webapp
BERJON Matthieu's avatar
BERJON Matthieu committed
8
9
10


def index(request):
BERJON Matthieu's avatar
BERJON Matthieu committed
11
    return render(request, "home.html")
BERJON Matthieu's avatar
BERJON Matthieu committed
12
13
14


def user(request):
15
16
    #  quotas = Quota.objects.all()
    users = User.objects.all()
BERJON Matthieu's avatar
BERJON Matthieu committed
17
    return render(request, "user.html", locals())
18
19
20
21
22
23
24


def list_webapps(request):
    webapps = Webapp.objects.all()
    return render(request, "webapps.html", locals())


BERJON Matthieu's avatar
BERJON Matthieu committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#  def signup(request):
#      if request.method == 'POST':
#          form = UserCreationForm(request.POST)
#          if form.is_valid():
#              form.save()
#              return redirect('poc_home')
#      else:
#          form = UserCreationForm()
#
#      return render(request, 'signup.html', {'form': form})
class SignUp(generic.CreateView):
    form_class = UserCreationForm
    success_url = reverse_lazy('login')
    template_name = 'signup.html'