Ejemplo n.º 1
0
    def handle(self, *args, **options):
        try:
            num = int(args[0])
        except (IndexError, ValueError):
            num = 100

        users = list(User.objects.all())
        batch = AddressBatch.objects.create(
            user=random.choice(users),
            timestamp=datetime.datetime.now(),
            tag="test-data",
            )

        for p in Parcel.objects.order_by("?")[:num]:
            a = Address(
                input_street=p.address,
                city="Providence",
                state="RI",
                )
            if not random.randint(0, 1):
                a.pl = p.pl
                a.mapped_by = random.choice(users)
                a.mapped_timestamp = datetime.datetime.now()
                if not random.randint(0, 1):
                    a.needs_review = False
            if not random.randint(0, 9):
                a.multi_units = True
            if not random.randint(0, 9):
                a.complex_name = "The Complex"
            if not random.randint(0, 5):
                a.notes = p.classcode

            a.save()
            a.batches.add(batch)
Ejemplo n.º 2
0
Archivo: utils.py Proyecto: oddbird/mlt
def create_address(**kwargs):
    defaults = {
        "input_street": "3635 Van Gordon St",
        "city": "Providence",
        "state": "RI",
    }
    defaults.update(kwargs)

    user = defaults.pop("user", create_user())

    from mlt.map.models import Address
    a = Address(**defaults)
    a.save(user=user)
    return a
Ejemplo n.º 3
0
Archivo: utils.py Proyecto: oddbird/mlt
def create_address(**kwargs):
    defaults = {
        "input_street": "3635 Van Gordon St",
        "city": "Providence",
        "state": "RI",
        }
    defaults.update(kwargs)

    user = defaults.pop("user", create_user())

    from mlt.map.models import Address
    a = Address(**defaults)
    a.save(user=user)
    return a
Ejemplo n.º 4
0
    def handle(self, *args, **options):
        try:
            num = int(args[0])
        except (IndexError, ValueError):
            num = 100

        users = list(User.objects.all())
        batch = AddressBatch.objects.create(
            user=random.choice(users),
            timestamp=datetime.datetime.now(),
            tag="test-data",
        )

        for p in Parcel.objects.order_by("?")[:num]:
            a = Address(
                input_street=p.address,
                city="Providence",
                state="RI",
            )
            if not random.randint(0, 1):
                a.pl = p.pl
                a.mapped_by = random.choice(users)
                a.mapped_timestamp = datetime.datetime.now()
                if not random.randint(0, 1):
                    a.needs_review = False
            if not random.randint(0, 9):
                a.multi_units = True
            if not random.randint(0, 9):
                a.complex_name = "The Complex"
            if not random.randint(0, 5):
                a.notes = p.classcode

            a.save()
            a.batches.add(batch)