1 | 26a27,29
|
---|
2 | > # Lookup table for table names introduced in order to prevent that users from declaring the same table twice
|
---|
3 | > db_table_lookup = {}
|
---|
4 | >
|
---|
5 | 123a127,143
|
---|
6 | >
|
---|
7 | > # Prevent users from declaring the same table twice
|
---|
8 | > def qualified_model_name(app_label, object_name):
|
---|
9 | >
|
---|
10 | > result = self.object_name
|
---|
11 | > if self.app_label:
|
---|
12 | > result = '%s.%s' % (self.app_label, self.object_name)
|
---|
13 | >
|
---|
14 | > return result
|
---|
15 | >
|
---|
16 | > qname = qualified_model_name(self.app_label, self.object_name)
|
---|
17 | > if self.db_table in db_table_lookup:
|
---|
18 | >
|
---|
19 | > raise Exception('db_table %s was already declared by %s and was redeclared by %s'
|
---|
20 | > % (self.db_table, db_table_lookup[self.db_table], qname))
|
---|
21 | >
|
---|
22 | > db_table_lookup[self.db_table] = qname
|
---|