def handle(self, *args, **options): export_models('data/kinds/representative.csv', models.RepresentativeKind.objects.order_by('ordinal'), ['ordinal', 'name', 'description']) export_models('data/kinds/institution.csv', models.InstitutionKind.objects.order_by('ordinal'), ['ordinal', 'name', 'description'])
def handle(self, *args, **options): for kind in models.RepresentativeKind.objects.all(): export_models( os.path.join('data', 'representatives', kind.name.encode('utf-8') + '.csv'), models.Representative.objects.filter(kind=kind).order_by( 'institution__name', 'name'), [('institution', 'institution__name'), 'name', 'email', 'phone', 'other_info'])
def handle(self, *args, **options): for kind in (models.InstitutionKind.objects .order_by('ordinal')): filename = os.path.join('data', 'institutions', kind.name.encode('utf-8') + '.csv') export_models(filename, models.Institution.objects .filter(kind=kind) .order_by('name'), ['name', 'email', 'phone', 'address', 'other_info'])
def handle(self, *args, **options): for i in xrange(len(MUNICIPALITIES)): municipality = MUNICIPALITIES[i] print '({:2}/{:2})'.format(i + 1, len(MUNICIPALITIES)), filename = os.path.join('data', 'territories', municipality.encode('utf-8') + '.csv') export_models(filename, models.Territory.objects .filter(municipality=municipality) .order_by('institution__name', 'elderate', 'city', 'street'), [('institution', 'institution__name'), 'elderate', 'city', 'street', 'numbers'])
def handle(self, *args, **options): export_models('data/snippets.csv', models.Snippet.objects.order_by('name'), ['name', 'body'])