1) The code which ensures all defaults get the prefix applied to them has been changed to work in all scenarios. Previously form field init would get the raw default, leading to the situation in #2.
2) Validation is now not carried out by to_python, but instead by the validate method. to_python is called during ORM lookups and as such was not the appropriate place for this particular style of validation (checking of prefix) as it would cause ORM lookups such as filter() and get_object_or_404 to blow up. Fixes #3.
3) Remove support for callable prefixes, when I developed this I assumed that a callable prefix would allow us to have a single field on an abstract = True Django model, and that the callable called in contribute_to_class would be passed the details of the concrete Django modal subclassing the abstract. This is however not the case, the method gets passed the details of the Abstract model and thus dynamically calculating any prefix based on some concrete model detail is impossible. Therefore the feature has been removed and we now have simple string prefixes only.
If applied this PR will..
1) The code which ensures all defaults get the prefix applied to them has been changed to work in all scenarios. Previously form field init would get the raw default, leading to the situation in #2.
2) Validation is now not carried out by
to_python
, but instead by thevalidate
method.to_python
is called during ORM lookups and as such was not the appropriate place for this particular style of validation (checking of prefix) as it would cause ORM lookups such asfilter()
andget_object_or_404
to blow up. Fixes #3.3) Remove support for callable prefixes, when I developed this I assumed that a callable prefix would allow us to have a single field on an
abstract = True
Django model, and that the callable called incontribute_to_class
would be passed the details of the concrete Django modal subclassing the abstract. This is however not the case, the method gets passed the details of the Abstract model and thus dynamically calculating any prefix based on some concrete model detail is impossible. Therefore the feature has been removed and we now have simple string prefixes only.