Skip to content

Commit

Permalink
populate database script updated to use Staff object for External Exa…
Browse files Browse the repository at this point in the history
…miners
  • Loading branch information
profcturner committed Nov 29, 2021
1 parent 9c90da6 commit f4209a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions loads/management/commands/populate_database.py
Expand Up @@ -22,7 +22,6 @@
from loads.models import Programme
from loads.models import Module
from loads.models import WorkPackage
from loads.models import ExternalExaminer


class Command(BaseCommand):
Expand Down Expand Up @@ -441,7 +440,7 @@ def create_externals(self, package, options):
self.stderr.write("ERROR: user already exists")
continue

if ExternalExaminer.objects.all().filter(staff_number=username):
if Staff.objects.all().filter(staff_number=username):
self.stderr.write("ERROR: staff number already in user")
continue

Expand All @@ -458,10 +457,12 @@ def create_externals(self, package, options):

# Create the linked staff objects
# Let's have mostly Full Time staff, but with some PT staff too
ExternalExaminer.objects.create(
Staff.objects.create(
user=user,
title=title,
staff_number=username,
is_external=True,
has_workload=False,
package=package
)

Expand All @@ -484,7 +485,7 @@ def create_programmes(self, package, options):

verbosity = options['verbosity']

externals = list(ExternalExaminer.objects.all().filter(package=package))
externals = list(Staff.objects.all().filter(package=package).filter(is_external=True))

for (programme_code, programme_name) in self.get_programme_names():
if verbosity:
Expand Down

0 comments on commit f4209a3

Please sign in to comment.