def _create_hub(): image_name = images.random_image(u'%s.png' % text.random_words(1)) data = { 'name': text.random_words(3).title(), 'contact': choice([None, _get_user()]), 'summary': text.random_words(10), 'connections': text.random_paragraphs(1), 'organization': choice([None, _get_organization()]), 'network_speed': NetworkSpeed.objects.all().order_by('?')[0], 'is_advanced': choice([True, False]), 'experimentation': choice(Hub.EXPERIMENTATION_CHOICES)[0], 'estimated_passes': text.random_words(10), 'description': text.random_paragraphs(3), 'image': image_name, 'website': _get_url(), 'status': choice(Hub.STATUS_CHOICES)[0], 'is_featured': choice([True, False]), 'position': locations.get_location(), } hub = Hub.objects.create(**data) _create_hub_membership(hub) _add_tags(hub) _add_features(hub) _add_applications(hub) return hub
def _create_testbed(): image_name = images.random_image(u'%s.png' % slugify(text.random_words(1))) data = { 'name': text.random_words(3).title(), 'summary': text.random_words(10), 'description': text.random_paragraphs(2), 'contact': choice([None, _get_user()]), 'organization': choice([None, _get_organization()]), 'website': _get_url(), 'image': image_name, 'network_speed': NetworkSpeed.objects.all().order_by('?')[0], 'connections': text.random_paragraphs(1), 'experimentation': choice(Testbed.EXPERIMENTATION_CHOICES)[0], 'passes_homes': randint(0, 100), 'passes_business': randint(0, 100), 'passes_anchor': randint(0, 100), 'is_advanced': choice([True, False]), 'position': locations.get_location(), 'status': choice(Testbed.STATUS_CHOICES)[0], } testbed = Testbed.objects.create(**data) _add_tags(testbed) _add_features(testbed) _add_applications(testbed) return testbed
def _create_organization(): name = text.random_words(3) image_name = u'%s.png' % slugify(text.random_words(1)) data = { 'name': name.title(), 'slug': slugify(name), 'status': choice(Organization.STATUS_CHOICES)[0], 'bio': _choice(text.random_words(30)), 'image': images.random_image(image_name), 'position': locations.get_location(), 'interest_ignite': _choice(text.random_paragraphs(1)), 'interests_other': _choice(text.random_words(5)), 'resources_available': _choice(text.random_paragraphs(1)), } organization = Organization.objects.create(**data) _add_tags(organization) _create_organization_membership(organization) return organization
def _create_hub(): image_name = images.random_image(u'%s.png' % text.random_words(1)) data = { 'name': text.random_words(3).title(), 'summary': text.random_words(10), 'description': text.random_paragraphs(3), 'contact': choice([None, _get_user()]), 'image': image_name, 'website': _get_url(), 'status': choice(Hub.STATUS_CHOICES)[0], 'is_featured': choice([True, False]), 'position': locations.get_location(), } hub = Hub.objects.create(**data) _create_hub_membership(hub) _add_tags(hub) _add_features(hub) return hub
def _create_resource(): name = text.random_words(4) data = { 'name': name.title(), 'slug': slugify(name), 'status': choice(Resource.STATUS_CHOICES)[0], 'description': text.random_paragraphs(1), 'contact': _get_user(), 'author': _choice(text.random_words(10)), 'resource_date': choice([_get_start_date(), None]), 'url': _get_url(), 'is_featured': choice([True, False]), 'image': images.random_image(u'%s.png' % text.random_words(1)), 'resource_type': _get_resource_type(), 'sector': _get_sector(), } resource = Resource.objects.create(**data) _add_tags(resource) return resource
def _create_challenge(): start_date = _get_start_date() end_date = start_date + timedelta(days=15) data = { 'name': text.random_words(5).title(), 'status': choice(Challenge.STATUS_CHOICES)[0], 'start_datetime': start_date, 'end_datetime': end_date, 'url': _get_url(), 'is_external': choice([True, False]), 'summary': text.random_paragraphs(1), 'description': text.random_paragraphs(3), 'image': images.random_image(u'%s.png' % text.random_words(1)), 'user': _get_user(), } challenge = Challenge.objects.create(**data) for i in range(0, 10): _create_question(challenge, i) _create_entries(challenge) return challenge
def _create_event(): start_date = _get_start_date() end_date = start_date + timedelta(hours=5) data = { 'name': text.random_words(5), 'status': choice(Event.STATUS_CHOICES)[0], 'image': images.random_image(u'%s.png' % text.random_words(1)), 'start_datetime': start_date, 'end_datetime': choice([None, end_date]), 'address': text.random_words(7), 'description': text.random_paragraphs(2), 'is_featured': choice([True, False]), 'user': _get_user(), 'position': locations.get_location(), } event = Event.objects.create(**data) _add_tags(event) for i in range(0, 3): event.hubs.add(_get_hub()) return event
def _create_app(): image_name = images.random_image(u'%s.png' % text.random_words(1)) data = { 'name': text.random_words(3).title(), 'stage': choice(Application.STAGE_CHOICES)[0], 'status': choice(Application.STATUS_CHOICES)[0], 'website': _get_url(), 'summary': _choice(text.random_words(20))[:140], 'impact_statement': text.random_words(20)[:140], 'assistance': _choice(text.random_words(30)), 'team_name': _choice(text.random_words(5)), 'team_description': _choice(text.random_words(30)), 'acknowledgments': _choice(text.random_words(30)), 'domain': _get_domain(), 'is_featured': choice([True, False]), 'owner': _get_user(), 'image': image_name, } application = Application.objects.create(**data) _add_tags(application) return application