Greetings, I'm in the process of porting an application from Django v0.96 (using Python 2.3) to v1.0 (using Python 2.4). I had been using django.core.validators, but since that doesn't exist in v1.0 I'm trying to replace the functionality with a custom field.
The code that I'm using is as follows: ######################################### # app_utils/__init.py__ from django.db.models import CharField class MacAddressField(CharField): def __init__(self, *args, **kwargs): kwargs['max_length'] = 17 super(MacAddressField, self).__init__(self, *args, **kwargs) def db_type(self): return 'varchar(17)' ######################################### # other_equipment/models.py from django.db import models from app_utils import MacAddressField class NetworkDevice(models.Model): mac_address = MacAddressField('MAC Address', primary_key=True) name = models.CharField(max_length=255) ip_address = CharField('IP Address', max_length=15, null=True, blank=True) def __unicode__(self): return u'%s' % (self.mac_address) ######################################### # other_equipment/admin.py from django.contrib import admin from other_equipment.models import NetworkDevice class NetworkDeviceAdmin(admin.ModelAdmin): list_display = ('mac_address', 'name', 'ip_address',) search_fields = ('mac_address', 'name', 'ip_address',) admin.site.register(NetworkDevice, NetworkDeviceAdmin) ######################################### The administrative interface for the model almost works... the problem that I'm currently working on is that instead of the seeing "MAC Address" as the mac_address label I see "<app_utils.MacAddressField object at 0x9995c2c>". Any clue as to what I'm doing wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---