A: A TextEmailField which does not have the ForeignKey, and
B: A model which has the foreign key and a TextEmailField
as a better and more standard approach?
On Thu, Jul 22, 2010 at 3:13 PM, Jonathan Hayward <christos.jonathan.hayward@gmail.com> wrote:
I am trying to make an EmailField variant which:1: Is based on TEXT rather than VARCHAR, and2: May be in a many-to-one relationship with entity.I presently have:class TextEmailField(models.EmailField):entity = models.ForeignKey(Entity)def __init__(self, *arguments, **keywords):models.EmailField.__init__(self, *arguments, **keywords)def get_internal_type(self):return u'TextField'A search for emails for a given Entity id is:emails = directory.models.TextEmailField.objects.filter(entity__exact =id).all()This is getting the error below. My best interpretation is that I'm attempting an operation on a field that is only defined for models. Is this correct? How should I be remedying it?
AttributeError at /profile/1
type object 'TextEmailField' has no attribute 'objects'
Request Method: GET Request URL: http://netbook:8000/profile/1 Django Version: 1.2.1 Exception Type: AttributeError Exception Value: type object 'TextEmailField' has no attribute 'objects'Exception Location: /home/jonathan/directory/../directory/views.py in profile, line 37 Python Executable: /usr/local/bin/python Python Version: 2.6.5 Python Path: ['/home/jonathan/directory', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-linux2', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages'] Server time: Thu, 22 Jul 2010 16:26:04 -0500
--
→ Jonathan Hayward, christos.jonathan.hayward@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.com/
--
→ Jonathan Hayward, christos.jonathan.hayward@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.com/
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment