#31683: Overridden methods ignored in models.DecimalField subclass
-------------------------------------+-------------------------------------
     Reporter:  Max Rothman          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  2.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  custom-model-fields  |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by felixxm):

 Replying to [comment:4 Max Rothman]:
 > So as a django user the way I was supposed to find this out was to read
 the source code?

 Writing a custom model field is quite advanced usage. You can create a
 subclass of `Field` and implement methods described in the How-to. If you
 want to create a subclass of the builtin fields you can also implement all
 methods or check an implementation and use relations between them. I don't
 see any contradiction.

 > The fact that this issue exists is proof that there is at least some
 kind of documentation issue.

 I don't see any issue here. If you want to raise an exception when
 converting values to database values you should override
 `get_db_prep_value()` as [https://docs.djangoproject.com/en/dev/howto
 /custom-model-fields/#converting-query-values-to-database-values
 documented].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31683#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.25eb64df42c4e11f683b665ee2bc11b9%40djangoproject.com.

Reply via email to