with the scaffolding app, it's as easy as replacing the standard index
function with yours and use
return dict(quote=quotes[day])
at the bottom of it instead of your
return quotes[day]
On Saturday, March 2, 2013 1:26:50 AM UTC+1, Erik Clinger wrote:
>
> I'm a self taught high school students trying to make a quote of the day
> website.
> Essentially what I'm trying to do is assign the day of the month equal to
> a quote that I have selected. The code runs just fine. I'll post it on the
> bottom.
> Anyway, the disconnect that I'm getting is inputting the application that
> I have written in Python to the a html template. I know that you need to
> have a controller, view and model files all to display the application
> correctly. I have absolutely no idea how to do this.
>
> Thank you so much for your time.
>
> Code:
>
> from datetime import date
>
>
> def index():
> quotes = {1: "We can't help everyone, but everyone can help. -President
> Ronald W. Reagan",
> 2: "There are no problems we cannot solve together, and very
> few that we can solve by ourselves. -President Lyndon B. Johnson",
> 3: "A people that values its privileges above its principles
> soon loses both. -President Dwight D. Eisenhower",
> 4: "Defeat doesn't finish a man, quit does. A man is not
> finished when he's defeated. He's finished when he quits. -President Richard
> M. Nixon",
> 5: "Change will not come if we wait for some other person or
> some other time. We are the ones we've been waiting for. We are the change
> that we seek. -President Barack H. Obama",
> 6: "If you live long enough, you'll make mistakes. But if you
> learn from them, you'll be a better person. It's how you handle adversity,
> not how it affects you. The main thing is never quit, never quit, never quit.
> -President William J. Clinton",
> 7: "One man with courage makes a majority. -President Andrew
> Jackson",
> 8: "Happiness lies in the joy of achievement and the thrill of
> creative effort. -President Franklin D. Roosevelt",
> 9: "Do not pray for easy lives. Pray to be stronger men.
> -President John F. Kennedy",
> 10: "When you get to the end of your rope, tie a knot and hang
> on. -President Thomas Jefferson",
> 11: "It is amazing what you can accomplish if you do not care
> who gets the credit. -President Harry S. Truman",
> 12: "Believe you can and you're halfway there. -President Theodore
> Roosevelt",
> 13: "Happiness and moral duty are inseparably connected. -President
> George Washington",
> 14: "I have a different vision of leadership. A leadership is
> someone who brings people together. -President George W. Bush",
> 15: "It is better to be defeated standing for a high principle than
> to run by committing subterfuge. -President S. Grover Cleaveland",
> 16: "You can do what you have to do, and sometimes you can do it
> even better than you think you can. -President E. Jimmy Carter",
> 17: "The only use of an obstacle is to be overcome. All that an
> obstacle does with brave men is, not to frighten them, but to challenge them.
> -President T. Woodrow Wilson",
> 18: "Patience and perseverance have a magical effect before which
> difficulties disappear and obstacles vanish. -President John Quincy Adams",
> 19: "The test of leadership is not to put greatness into humanity,
> but to elicit it, for the greatness is already there. -President James
> Buchanan",
> 20: "Nothing in this world can take the place of persistence.
> Talent will not; nothing is more common than unsuccessful people with talent.
> Genius will not; unrewarded genius is almost a proverb. Education will not;
> the world is full of educated failures. Persistence and determination alone
> are omnipotent. -President J. Calvin Coolidge",
> 21: "History and experience tell us that moral progress comes not
> in comfortable and complacent times, but out of trial and confusion.
> -President Gerald R. Ford",
> 22: "Right reason is stronger than force. -President James A.
> Garfield",
> 23: "The bud of victory is always in the truth. -President Benjamin
> Harrison",
> 24: "For honest merit to succeed amid the tricks and intrigues
> which are now so lamentably common, I know is difficult; but the honor of
> success is increased by the obstacles which are to be surmounted. Let me
> triumph as a man or not at all. -President Rutherford B. Hayes",
> 25: "Peace is not made at the council table or by treaties, but in
> the hearts of men. -President Herbert C. Hoover",
> 26: "Let us tenderly and kindly cherish, therefore, the means of
> knowledge. Let us dare to read, think, speak, and write. -President John
> Adams",
> 27: "Character is like a tree and reputation like a shadow. The
> shadow is what we think of it; the tree is the real thing. -President Abraham
> Lincoln",
> 28: "In the time of darkest defeat, victory may be nearest.
> -President William McKinley",
> 29: "It would be judicious to act with magnanimity towards a
> prostrate foe. -President Zachary Taylor",
> 30: "Popularity, I have always thought, may aptly be compared to a
> coquette: the more you woo her, the more apt is she to elude your embrace.
> -President John Tyler",
> 31: "Let us have peace. -President Ulysses S. Grant"
> }
> day = date.today().day
> return quotes[day]
>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.