def clean_table_id(self): table_id = self.cleaned_data['table_id'] table_name = get_table_name(self.domain, table_id) if len(table_name) > 63: # max table name length for postgres raise ValidationError( _('Table id is too long. Your table id and domain name must add up to fewer than 40 characters') ) return table_id
def clean_table_id(self): table_id = self.cleaned_data["table_id"] table_name = get_table_name(self.domain, table_id) if len(table_name) > 63: # max table name length for postgres raise ValidationError( _("Table id is too long. Your table id and domain name must add up to fewer than 40 characters") ) for src in self.instance.by_domain(self.domain): if src.table_id == table_id and src.get_id != self.instance.get_id: raise ValidationError(_("A data source with this table id already exists. Table" " ids must be unique")) return table_id
def clean_table_id(self): # todo: validate table_id as [a-z][a-z0-9_]* table_id = self.cleaned_data['table_id'] table_name = get_table_name(self.domain, table_id) if len(table_name) > 63: # max table name length for postgres raise ValidationError( _('Table id is too long. Your table id and domain name must add up to fewer than 40 characters' )) for src in self.instance.by_domain(self.domain): if src.table_id == table_id and src.get_id != self.instance.get_id: raise ValidationError( _('A data source with this table id already exists. Table' ' ids must be unique')) return table_id
def clean_table_id(self): # todo: validate table_id as [a-z][a-z0-9_]* table_id = self.cleaned_data['table_id'] table_name = get_table_name(self.domain, table_id) if len(table_name) > 63: # max table name length for postgres raise ValidationError( _('Table id is too long. Your table id and domain name must add up to fewer than 40 characters') ) for src in self.instance.by_domain(self.domain): if src.table_id == table_id and src.get_id != self.instance.get_id: raise ValidationError( _('A data source with this table id already exists. Table' ' ids must be unique') ) return table_id
def table_name(self): return get_table_name(self.domain, 'patient_summary')
def table_name(self): return get_table_name(self.config['domain'], 'unicef_malawi')
def table_name(self): return get_table_name(self.config['domain'], "malaria_consortium")
def table_name(self): return get_table_name(self.config['domain'], self.slug)
def table_name(self): return get_table_name(self.config['domain'], 'location_hierarchy')
def table_name(self): return get_table_name(self.domain, self.config.table_id)
def test_long_table_name(self): name = get_table_name('this_is_a_long_domain', 'and_a_long_table_name') name_expected = 'config_report_this_is_a_long_domain_and_a_long_table_n_6ac28759' self.assertEqual(name, name_expected)
def test_table_trickery(self): tricky_one = get_table_name('domain_trick', 'table') tricky_two = get_table_name('domain', 'trick_table') self.assertNotEqual(tricky_one, tricky_two)
def test_table_name(self): self.assertEqual('config_report_domain_table_7a7a33ec', get_table_name('domain', 'table'))
def table_name(self): return get_table_name(self.config['domain'], TABLE_ID)
def table_name(self): return get_table_name(self.config['domain'], "weekly_forms")
def test_trickery(self): tricky_one = get_table_name('domain_trick', 'table') tricky_two = get_table_name('domain', 'trick_table') self.assertNotEqual(tricky_one, tricky_two)
def _get_all_table_names(): return map(lambda dsc: get_table_name(dsc.domain, dsc.table_id), userreports_models.DataSourceConfiguration.all())