You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
782 B
Python

# coding: utf-8
# Author: Grizzly
#
# Views for litl.
from django.shortcuts import render
from django.http import HttpResponseRedirect
from .settings import TEMPLATES
from .models import Slug
from .forms import SlugAddForm
def index(request):
"""Display the home page of the site.
TODO: Search and display the urls shortened by the user in the past.
"""
context = {}
return render(request,'base.html',context)
def AddSlug(request):
"""Display the form for creating a new slug.
"""
if request.method == 'POST':
form = SlugAddForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('')
else:
form = SlugAddForm()
return render(request,'add_slug.html',{'form':form})