Re: more fun with custom fields

2006-10-12 Thread Malcolm Tredinnick
On Thu, 2006-10-12 at 17:11 -0400, [EMAIL PROTECTED] wrote: > ok, I made this change to the Model.__init__() method. at the very end: > > for i, arg in enumerate(args): > + if hasattr(self._meta.fields[i], 'translate_from_db') and arg: > + arg = self._meta.fields[i

Re: more fun with custom fields

2006-10-12 Thread bfordham
ok, I made this change to the Model.__init__() method. at the very end: for i, arg in enumerate(args): + if hasattr(self._meta.fields[i], 'translate_from_db') and arg: + arg = self._meta.fields[i].translate_from_db(arg) setattr(self, self._meta.fields[i

Re: more fun with custom fields

2006-10-12 Thread Bryan L. Fordham
>Not at the moment. There are two problems that need solving here (I've >mentioned this before either on this list or django-dev) and they're >both still on my endless TODO list. I'll get to them one day. > > I bet your todo list looks like mine 8) >(1) For fields that are Python wrappers over

Re: more fun with custom fields

2006-10-11 Thread Malcolm Tredinnick
On Wed, 2006-10-11 at 10:51 -0400, [EMAIL PROTECTED] wrote: [...] > On a more general note, is there an accepted way to add fields into > contrib? I'd like to be able to have Django create tables with geometry > columns, and using any typecasts I may end with, without the end user > having to modi

Re: more fun with custom fields

2006-10-11 Thread [EMAIL PROTECTED]
Hi Don. Yeah, I'm actually following Adrian's approach in some code now. What I want to do, though, is be able to include geometry fields directly in the model --B On Oct 11, 11:52 am, Don Arbow <[EMAIL PROTECTED]> wrote: > Note that Adrian posted a message some time ago about how he uses > geom

Re: more fun with custom fields

2006-10-11 Thread Don Arbow
Note that Adrian posted a message some time ago about how he uses geometry fields in Postgres and Django for his chicagocrime.org site. His post is in this thread: http://groups.google.com/group/django-users/browse_thread/thread/ 1fbbaf710996a8aa/8b322b5b68b29fbb? lnk=gst&q=postgis&rnum=1#8

more fun with custom fields

2006-10-11 Thread bfordham
So I've made some progress on using Points in Django. In postgres, I added a filter (using Database.register_type) to automatically convert points to a tuple. That worked really well for reading the data out. To store, for example, the tuple (30, 30) as a point I have to call GeometryFromText('P