aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-02-18 15:07:09 +0000
committerMatthew Lemon <matt@matthewlemon.com>2020-02-18 15:07:09 +0000
commit52dab6236c433bd4ee34f03bf7bae470cf384d8a (patch)
tree3ba98c0fa21b46c23cfc2161566113c58f10243d
parent89389a0b09a7d80f8653ebc5d1640f33dd8d9e06 (diff)
part way through writing management command for populating db
-rw-r--r--ctrack/organisations/management/commands/generate_people.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/ctrack/organisations/management/commands/generate_people.py b/ctrack/organisations/management/commands/generate_people.py
index d3fd45e..0e6b03e 100644
--- a/ctrack/organisations/management/commands/generate_people.py
+++ b/ctrack/organisations/management/commands/generate_people.py
@@ -1,10 +1,10 @@
-import factory
+from datetime import datetime
+import factory
from django.core.management.base import BaseCommand, CommandError
+from factory import DjangoModelFactory, Faker, SubFactory, post_generation
-from factory import DjangoModelFactory, Faker, post_generation, SubFactory
-
-from ctrack.organisation.models import Person, Organisation
+from ctrack.organisation.models import Organisation, Person
class OrganisationFactory(DjangoModelFactory):
@@ -12,32 +12,31 @@ class OrganisationFactory(DjangoModelFactory):
class PersonFactory(DjangoModelFactory):
-
class Meta:
model = Person
primary_nis_contact = True
voluntary_point_of_contact = True
has_egress = False
- title = Faker("prefix")
+ title = Faker("prefix")
job_title = Faker("job")
first_name = Faker("first_name")
last_name = Faker("last_name")
- organisation = SubFactory(OrganisationFactory)
- role =
- email =
- secondary_email =
- mobile =
- landline =
- date_updated =
- updated_by =
+ organisation = SubFactory(OrganisationFactory) # TODO we need to create OrganisationFactory
+ role = Faker("job")
+ email = Faker("ascii_company_email")
+ secondary_email = "ascii_company_email"
+ mobile = Faker("msisdn", locale="en_GB")
+ landline = Faker("phone_number", locale="en_GB")
+ date_updated = factory.LazyFunction(datetime.now)
+ updated_by = # TODO we need to create a fake User
clearance =
clearance_sponsor =
- clearance_start_date =
- clearance_last_checked =
- clearance_expiry =
- active =
- date_ended =
+ clearance_start_date =
+ clearance_last_checked =
+ clearance_expiry =
+ active = True
+ date_ended =
predecessor =
comments =
@@ -49,6 +48,7 @@ class Command(BaseCommand):
python manage.py generate_people
"""
+
# def add_arguments(self, parser):
# parser.add_argument("year", nargs="+", type=int)
#