From 70711888ea563790b4b4958ef3f8f1ae465e011d Mon Sep 17 00:00:00 2001 From: Challenger Date: Fri, 9 Jun 2023 00:14:56 +0530 Subject: [PATCH] Using constants from APIs/constants.py now --- CDC_Backend/scripts/add_students.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CDC_Backend/scripts/add_students.py b/CDC_Backend/scripts/add_students.py index 1602a58..e540204 100644 --- a/CDC_Backend/scripts/add_students.py +++ b/CDC_Backend/scripts/add_students.py @@ -2,9 +2,12 @@ import random from django.db.utils import IntegrityError from APIs.models import Student +from APIs.constants import BRANCHES, BATCH_CHOICES, DEGREE_CHOICES + # To run this script run the following command: # python manage.py runscript add_students --script-args + def run(*args): # Throw error if invalid number of arguments passed @@ -39,11 +42,11 @@ def run(*args): id = i-1, roll_no = 220010000 + i, name = "Student " + str(i), - branch = random.choice(["CSE", "EE", "MECH", "CHEM", "CIVIL", "EP", "BSMS", "MNC"]), + branch = random.choice(BRANCHES), phone_number = random.randint(1000000000, 9999999999), cpi = random.random()*10, - degree = "bTech", - batch = random.randint(2018, 2023) + degree = random.choice(DEGREE_CHOICES)[0], + batch = random.choice(BATCH_CHOICES)[0], ) student.save() except IntegrityError: