#18528 closed Bug (fixed)
Field.value_to_string documentation broken
| Reported by: | anuraguniyal | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.4 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
See https://docs.djangoproject.com/en/1.4/howto/custom-model-fields/#django.db.models.Field.value_to_string , it gives a sample as
class HandField(models.Field):
# ...
def value_to_string(self, obj):
value = self._get_val_from_obj(obj)
return self.get_db_prep_value(value)
but it will not work in 1.4 due to TypeError: get_db_prep_value() takes at least 3 arguments (2 given)
Change History (4)
comment:1 by , 13 years ago
| Easy pickings: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Type: | Cleanup/optimization → Bug |
comment:3 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I would use
get_prep_valueinstead ofget_db_prep_value. Opinions?