summaryrefslogtreecommitdiff
path: root/account
diff options
context:
space:
mode:
authorcoderick142017-05-19 15:14:33 +0530
committercoderick142017-05-19 15:14:33 +0530
commit1ccdaf5f508cd863afbd328691a6396b616fb068 (patch)
tree812fd3fff2a859287a4d428e0b8583002776c7a8 /account
parentca8e51f4399e41957d4acae4810c28b255607e6a (diff)
downloadSBHS-2018-Rpi-1ccdaf5f508cd863afbd328691a6396b616fb068.tar.gz
SBHS-2018-Rpi-1ccdaf5f508cd863afbd328691a6396b616fb068.tar.bz2
SBHS-2018-Rpi-1ccdaf5f508cd863afbd328691a6396b616fb068.zip
Handle error when no boards are online
Diffstat (limited to 'account')
-rw-r--r--account/views.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/account/views.py b/account/views.py
index 8f11d26..5fbb14a 100644
--- a/account/views.py
+++ b/account/views.py
@@ -60,11 +60,18 @@ def create(req):
return redirect(index)
# try:
+
+ # check if a board could be allocated
+ allocated_board_id = Board.allot_board()
+ if allocated_board_id == -1:
+ messages.add_message(req, messages.ERROR, "Sorry!! No boards online at this moment. Try again in some time.")
+ return redirect(index)
+
account = Account(
name=name,
username=username,
email=email,
- board_id=Board.allot_board(),
+ board_id=allocated_board_id,
last_login=datetime.now().strftime("%Y-%m-%d %H:%M")
)
account.set_password(password)