You're almost there.

Yes, put all of the if/then logic in the controller, that what controllers are made for.

The purpose of MVC separation is make the View and Controller completely abstracted pieces.

Ideally, doing any HTML work in the controller is an MVC violation.  Instead you should pass a list of strings (of scholarships in this case) to your view.  Like so:
schols = []
schols.append('Random Free Money')

return dict(schols = schols)

And then in your view, loop over the list with the appropriate markup.

-tim


Wes James wrote:
Is the best place to create data for views in the controller.  For
instance,  after a student enters some initial data, I need to look at
that data and determine what scholarships they might be eligible for.
Along with the student data and a scholarship table, I need to do a
bunch of "if then" logic.  Would I put that in the controller?

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 <[EMAIL PROTECTED]>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to