views.py 774 Bytes
Newer Older
Jean Michel Rouly's avatar
Jean Michel Rouly committed
1
2
from go.models import URL
from django.contrib.auth.models import User
3
from django.contrib.auth.decorators import login_required
Jean Michel Rouly's avatar
Jean Michel Rouly committed
4
from django.shortcuts import render, get_object_or_404, redirect
5

Jean Michel Rouly's avatar
Jean Michel Rouly committed
6
# Homepage view.
7
@login_required
Jean Michel Rouly's avatar
Jean Michel Rouly committed
8
9
10
11
12
13
def index(request):
    return render(request, 'index.html', {

    },
    )

14
15
16
17
18
19
20
21
22
23
24
25
26
27
# My-Links page.
@login_required
def my_links(request):
    links = URL.objects.filter( owner = request.user )

    return render(request, 'my_links.html', {
        'links' : links,
    },
    )

# Delete link page.
def delete(request, short):
    return redirect('index')

Jean Michel Rouly's avatar
Jean Michel Rouly committed
28
29
30
31
32
33
# About page, static.
def about(request):
    return render(request, 'about.html', {

    },
    )
Jean Michel Rouly's avatar
Jean Michel Rouly committed
34
35
36
37
38
39
40

# Signup page.
def signup(request):
    return render(request, 'signup.html', {

    },
    )