> If you have the ability to change your Call model, you should consider
> adding a new BooleanField called "is_long_distance" to Call. Then, you
> only have to compute it (in Call.save()) when you save or change a
> number. That will make your query very simple and efficient.
>
> -Rajesh D

I would disagree here. The database should only be used to store raw
data; the database should not know anything about this data (the
database should not be "smart").

Determining whether or not a number qualifies as "long distance" is a
job for the domain / controller / view layer (pick your jargon).

Here's why. Suppose the company moves, or the geographical scope of
one area code is changed. Now you have a different set of rules that
determine what qualifies a number as being "long distance." Would you
rather change the rule with one line of code in your view, or
construct and run some SQL that finds and updated all matching phone
numbers? (Note: this is meant to be a rhetorical question but could
very well be debated.)

Sorry for the tangent. I'm a stickler for best practices.

Cheers,
Ross
--~--~---------~--~----~------------~-------~--~----~
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