New field proposal

3 views
Skip to first unread message

mario__

unread,
Feb 22, 2007, 3:46:52 PM2/22/07
to Django developers
Hello, I've been doing some changes in django source code by my self
to see where I can go and I think I can go further :-) I've got an
idea.

My backend is PostgreSQL and days ago I had to declare a field
range, I mean by every INSERT I needed to accept numbers between 100
and 50000 only and that restriction I did by 'hand' with psql
(CHECK). IMO could be easier to have a Field similar to
PositiveIntergerField(), something like:

RangeIntegerField(begin=100, end=50000)

What do you think if I try to write a patch for that?

Regards!

Aidas Bendoraitis

unread,
Feb 23, 2007, 6:09:05 AM2/23/07
to django-d...@googlegroups.com
I think, you should rather create that field as a separate project,
just as Jannis Leidel did with geoposition field:
http://code.google.com/p/django-coordinatesfield/.
If it is useful to others as well as to you, maybe somebody will add
it to the core.

Also personally I think that a custom validator is enough for such a
restriction that you need. And it would be much more important to
implement BLOB fields for saving binary files in the database.

Regards,
Aidas Bendoraitis [aka Archatas]

mario__

unread,
Feb 23, 2007, 10:41:22 AM2/23/07
to Django developers
On Feb 23, 8:09 am, "Aidas Bendoraitis" <aidas.bendorai...@gmail.com>
wrote:

> I think, you should rather create that field as a separate project,
> just as Jannis Leidel did with geoposition field:http://code.google.com/p/django-coordinatesfield/.
> If it is useful to others as well as to you, maybe somebody will add
> it to the core.
>

mmhh, good idea.

> Also personally I think that a custom validator is enough for such a
> restriction that you need. And it would be much more important to
> implement BLOB fields for saving binary files in the database.
>

Could be, however if IntegerField was enough why
PositiveIntegerField() and others was developed? Also, is a custom
validator able to generate SQL code for check constraints. IMO,
there's nothing better to leave the database handle those things.

Regards!

>

Reply all
Reply to author
Forward
0 new messages