On 12/13/05, braver <[EMAIL PROTECTED]> wrote:
> OK, can someone please explain to a pythonista what exactly does a
> phrase like
>
> has_many :milestones
>
> mean, and what in python prevents us from mimicking it more closely?

It's expressing a many-to-many or many-to-one relationship. For
example, if you were to take the poll app from the Django tutorial and
translate it into Rails, you'd have something like this in your Poll
model:

Class Poll < ActiveRecord::Base
  has_many :choices

And then your Choice model would look like:

Class Choice < ActiveRecord::Base
  belongs_to :poll

And this would accomplish the same as the ForeignKey field in the
Choice model in Django.

Nothing in Python really prevents this sort of system, but in Python
it's generally preferred to be more explicit about things, which is
why in Django you specify all your model's fields in the class,
instead of having them inferred from the database as in Rails.


--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

Reply via email to