Commit 1dd6d26b authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Defined the is_registered test for views.

parent ac185296
from go.models import URL
from go.models import URL, RegisteredUser
from go.forms import URLForm
from datetime import timedelta
from django.http import Http404
......@@ -8,6 +8,13 @@ from django.core.exceptions import PermissionDenied
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
def is_registered( user ):
try:
registered = RegisteredUser.objects.get( user=user )
return True
except RegisteredUser.DoesNotExist:
return False
# Homepage view.
@login_required
def index(request):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment