hi kevin,

you could convert to int in the model's save() method

class MyModel(models.Model):
    def save(self):
        self.hexval = int(str(self.hexval), 16)
    super(MyModel, self).save()

or whatever hex->decimal method you need for how you have the hex val
stored.

but then how to get it back into a hex representation when someone goes
to edit the field?  the only thing that comes to my mind is javascript
but i'm sure there's a less hackish solution :)

best
jake

Kevin wrote:
> In the admin interface if someone enters a number in hex, then it
> fails the validation test. I've managed to make it pass the validation
> test, but now the number gets passed in hex to the back-end database
> (which does not support hex). Any ideas on how I might be able to
> convert the number to an integer before it hits the database?
> 
> Thanks,
> Kevin
> 
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to