Hello

I am trying to create a new Input Widget called 'MapInput'. However the 
line : "from util import flatatt" from my widgets.py seems to break 
something. My code comes from the newforms/widgets.py file.

If I comment the lines relatives to the flatatt, my widget works fine.

Do you ave any ideas ?

Error :
=======
Request Method:         GET
Request URL:    http://immo.safre:8080/admin/houses/house/1/
Exception Type:         ViewDoesNotExist
Exception Value:        Could not import immo.houses.a_views. Error was: No 
module named util
Exception Location: 
/usr/lib/python2.5/site-packages/django/core/urlresolvers.py in 
_get_callback, line 136


widgets.py :
=============
from util import flatatt
from django.utils.datastructures import MultiValueDict
from django.utils.html import escape
from django.utils.translation import gettext
from django.utils.encoding import StrAndUnicode, smart_unicode
from itertools import chain

from django.newforms import widgets

try:
     set # Only available in Python 2.4+
except NameError:
     from sets import Set as set # Python 2.3 fallback


class MapInput(widgets.Input):
     """
     Render the map with two hidden fields : lng, lat
     """
     def __init__(self, attrs=None):
         self.attrs = {'id': 'map', 'style': 'width: 400px; height: 400px'}
         if attrs:
             self.attrs.update(attrs)

     def render(self, name, value, attrs=None):
         if value is None: value = ''
         final_attrs = self.build_attrs(attrs, name=name)
         return u'<div%s></div>' % (flatatt(final_attrs), escape(value))


Thomas

--~--~---------~--~----~------------~-------~--~----~
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