You saw this? https://docs.djangoproject.com/en/dev/howto/custom-model-fields/#django.db.models.Field.to_python
On Tue, Jun 19, 2012 at 9:38 AM, Melvyn Sopacua <[email protected]>wrote: > Hi, > > When using a custom field as primary key, and subsequently as a > ForeignKey the database representation gets stored as the related value > on the object. > This is a problem when it has to match the selected value in a form and > the documentation doesn't provide any clues where I should be overriding > a SubFieldBase method. > > There's some mention of force_unicode() being used and providing > __unicode__ methods, however since I don't have access to the instance > value from self I have no clue how to do the conversion. > > I've found the code responsible for setting the selected attribute in > forms/widgets.py, but having a really hard time figuring out what method > sets the "value" argument to the Select.render() method and how it > relates to my custom field. > > Help? > > -- > Melvyn Sopacua > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- juanpex -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

