For instance, the student is a female, in such and such major and is a
senior. For each scholarship I must then look at the DB and determine
the requirements and if they are eligible, tack that Scholarship name
in to: response.schols += "<li>This Scholarshiip</li>" and then do
respons.total += db.scholarship_amount. And then in my form do:
<output>
You are eligible for these scholarships:
{{=response.schols}}
You could receive as much as ${{response.total}} for the school year.
</output>
Is this correct?
thx,
-wj
-- Timothy Farrell <tfar...@swgen.com> Computer Guy Statewide General Insurance Agency (www.swgen.com)
In the simple case, this decays to something looking like this:
view: index.html:
{{ =person }}
controlller: default.html::index()
I'm not saying that the (presentation) view knows anything about the
model just that the change to the model could be catered for by a
(database/model) view, i.e. even the controller might not need to know
that the persistence model has changed.
Assuming you are referring to the current SQLFORM, this seems to me
>
> In the simple case, this decays to something looking like this:
>
> view: index.html:
>
> {{ =person }}
>
> controlller: default.html::index()
>
> ...
> person = SQLFORM( db.person)
>
> and SQLFORM is the utility function that operates as the controller
> interface to the data layer.
>
the key area for debate. An SQLFORM is created by the controller and
pre-determines what the view can do, i.e. it creates an html form.
Until the recent patch, the view couldn't even extract the current
value of a field without navigating through a tree of html helpers. I
agree that something must act as the bridge between the view and the
model, I just think that SQLFORM is not the way to do it.
My approach is to use a class (Resource) to act as the bridge between
view and data. The resource is constructed by the controller and the
controller can apply constraints, i.e. limit what the view can do but
in a functional not a presentational way. So, for example, the
controller can specify that a resource cannot be deleted but couldn't
say that the view could only output an html form. The controller could
receive an update request without a form being displayed (as web2py
can now) but doesn't have to create an SQLFORM to process that request
- it just creates the resource, updates it with the request and, if
valid, persists it.