Commit af01c202 authored by David Haynes's avatar David Haynes
Browse files

temporary storage

- need to look into git stash edition
parent 7feb2fd6
......@@ -9,7 +9,7 @@ class URLAdmin(admin.ModelAdmin):
class RegisteredUserAdmin(admin.ModelAdmin):
list_display = ("username", "full_name", "organization", "approved")
list_display = ("full_name", "organization", "approved")
admin.site.register(URL, URLAdmin)
admin.site.register(RegisteredUser, RegisteredUserAdmin)
......@@ -59,7 +59,7 @@ class RegisteredUser(models.Model):
that that user is registered.
"""
username = models.OneToOneField(
user = models.OneToOneField(
User,
on_delete=models.CASCADE,
primary_key=True,
......@@ -77,7 +77,9 @@ class RegisteredUser(models.Model):
description = models.TextField(blank=True)
approved = models.BooleanField()
approved = models.BooleanField(default=False)
registered = models.BooleanField(default=False)
def __unicode__(self):
return '<Registered User: %s - Approval Status: %s>' % (self.username, self.approved)
......@@ -5,6 +5,7 @@ from django.utils import timezone
from django.core.exceptions import PermissionDenied # ValidationError
from django.core.mail import send_mail, EmailMessage
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.models import User
from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render, get_object_or_404, redirect
......@@ -26,26 +27,14 @@ def is_approved(user):
This function checks if a user account has a corresponding RegisteredUser,
thus checking if the user is approved.
"""
try:
registered = RegisteredUser.objects.get(username=user.username)
return registered.approved
except RegisteredUser.DoesNotExist:
return False
return user.RegisteredUser
def is_registered(user):
"""
This function checks if a user account has a corresponding RegisteredUser,
thus checking if the user is registered.
"""
try:
registered = RegisteredUser.objects.get(username=user.username)
return True
except RegisteredUser.DoesNotExist:
return False
return user.registereduser.requested
##############################################################################
"""
......
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