1

I wish to add a custom constraint to a GeoDjango table.

This is the corresponding sql-statement:

ALTER TABLE my_table
   ADD CONSTRAINT enforce_valid_geom CHECK (ST_IsValid(geom));

Do I really have to inject the sql directly?

That seems like a frequently occurring constraint to me.

1 Answer 1

1

I would add the constraint in a migration. Or, in something more pretty: a custom field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.