File tree Expand file tree Collapse file tree
packages/django-google-spanner/django_spanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414from .introspection import DatabaseIntrospection
1515from .operations import DatabaseOperations
1616from .schema import DatabaseSchemaEditor
17+ from .validation import DatabaseValidation
1718
1819
1920class DatabaseWrapper (BaseDatabaseWrapper ):
@@ -87,6 +88,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
8788 introspection_class = DatabaseIntrospection
8889 ops_class = DatabaseOperations
8990 client_class = DatabaseClient
91+ validation_class = DatabaseValidation
9092
9193 @property
9294 def instance (self ):
Original file line number Diff line number Diff line change 1+ import os
2+
3+ from django .core import checks
4+ from django .db .backends .base .validation import BaseDatabaseValidation
5+ from django .db .models import DecimalField
6+
7+
8+ class DatabaseValidation (BaseDatabaseValidation ):
9+
10+ def check_field_type (self , field , field_type ):
11+ errors = []
12+ # Disable the error when running the Django test suite.
13+ if os .environ .get ('RUNNING_SPANNER_BACKEND_TESTS' ) != '1' and isinstance (field , DecimalField ):
14+ errors .append (
15+ checks .Error (
16+ 'DecimalField is not yet supported by Spanner.' ,
17+ obj = field ,
18+ id = 'spanner.E001' ,
19+ )
20+ )
21+ return errors
You can’t perform that action at this time.
0 commit comments