class JurisdictionCsvModel(CsvModel): """CSV import model for jurisdictions""" name = CharField() slug = CharField() level = CharField(transform=lambda x: x.lower()[0]) parent = DjangoModelField(Jurisdiction, pk='name') class Meta: dbModel = Jurisdiction delimiter = ',' update = {'keys': ['slug', 'parent']}
class JurisdictionCsvModel(CsvModel): """CSV import model for jurisdictions""" name = CharField() slug = CharField() level = CharField(transform=lambda x: x.lower()[0]) parent = DjangoModelField(JurisdictionModels.Jurisdiction, pk='name') class Meta: # pylint: disable=too-few-public-methods dbModel = JurisdictionModels.Jurisdiction delimiter = ',' update = {'keys': ['slug', 'parent']}
class PokemonCsv(CsvModel): number = IntegerField() code = IntegerField() serial = IntegerField() name = CharField() type1 = CharField() type2 = CharField() color = CharField() ability1 = CharField() ability2 = CharField() hidden_ability = CharField() generation = IntegerField() legendary = IntegerField() mega_evolution = IntegerField() height = FloatField() weight = FloatField() hp = IntegerField() attack = IntegerField() defense = IntegerField() special_attack = IntegerField() special_defense = IntegerField() speed = IntegerField() total = IntegerField() class Meta: dbModel = Pokemon delimiter = "," has_header = True
class AgencyCsvModel(CsvModel): """CSV import model for agency""" name = CharField() slug = CharField() jurisdiction = DjangoModelField(Jurisdiction, prepare=get_jurisdiction) contact_first_name = CharField() contact_last_name = CharField() contact_title = CharField() url = CharField() status = CharField() class Meta: dbModel = Agency delimiter = ',' update = {'keys': ['name', 'jurisdiction']}
class MyCSvModel (CsvModel): customer = CharField() item = CharField() total = IntegerField() quantity = IntegerField() date = DateField()
class AgencyCsvModel(CsvModel): """CSV import model for agency""" name = CharField() slug = CharField() jurisdiction = DjangoModelField(Jurisdiction, prepare=get_jurisdiction) address = CharField() email = CharField(validator=EmailValidator) other_emails = CharField() contact_first_name = CharField() contact_last_name = CharField() contact_title = CharField() url = CharField() phone = CharField() fax = CharField() status = CharField() class Meta: # pylint: disable=too-few-public-methods dbModel = Agency delimiter = ',' update = {'keys': ['name', 'jurisdiction']}