Closed owais closed 9 years ago
You sure can, here's an example of a schema loaded at runtime where the schema is defined in the database:
@receiver(signals.post_init)
def update_schema(sender, **kwargs):
# If we don't exclude these two, we get an infinite recursion
if sender.__name__ in ['ExtraField', 'ContentType']:
return
try:
field = sender._meta.get_field('extra_fields')
except FieldDoesNotExist:
field = None
if not isinstance(field, hstore.DictionaryField):
return
schema = SCHEMA[sender]
if schema:
field.reload_schema(schema)
thanks @aidanlister for the response.
If anyone has other questions, please use the mailing list. Use this issue tracker for bug reports.
Thank you for your understanding
Best regards Federico
I'm writing something like this,
Is it possible to override the schema at run time so we can have different schema for cars and bikes? For example in the
__init__
of the model?