go_extras.py 520 Bytes
Newer Older
1
2
3
4
from django import template
from go.models import RegisteredUser
register = template.Library()

5

6
@register.filter
7
def is_registered(user):
8
    try:
9
        registered = RegisteredUser.objects.get(username=user.username)
10
11
12
        return True
    except RegisteredUser.DoesNotExist:
        return False
13

14

15
16
17
@register.filter
def is_approved(user):
    try:
18
        registered = RegisteredUser.objects.get(username=user.username)
19
20
        return registered.approved
    except RegisteredUser.DoesNotExist:
21
        return False