Hi Em - I'm taking baby steps at the moment and simply don't understand how the form.as_table works... ie when i put that in the template (see my template below), how does it know which form to show?
BR On Thu, Jun 5, 2008 at 11:50 AM, Emily Rodgers <[EMAIL PROTECTED]> wrote: > > Hi, > > It seems familiar to an issue I had last week. > > Can we see the function in your views file? I am guessing that you need > to instantiate your ziplookup object or something (I think this is what > I did wrong). Try changing {{ form.as_table }} to {{ form }}, just to > see what it prints... > > I could be worng (I taught myself to code so have plenty of bad > habits!!), but I think the convention when defining classes is to use > CamelCase: http://en.wikipedia.org/wiki/CamelCase for the class name - > it helps to differentiate between function calls and object > instantiations when reading your code. > > Em :) > > PS python rocks. > > > -----Original Message----- > > From: django-users@googlegroups.com > > [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts > > Sent: 05 June 2008 16:36 > > To: Django users > > Subject: forms - WTF > > > > > > hey - > > > > I'm new to Django so bear with me and thank you in advance > > for any help you can lend. I can't seem to get my hands > > around the model/form/ view/template thing. I LOVE the idea > > but you have to understand i'm a MS ASP programmer who is > > switching over to python. > > > > Now with that being said here is my understanding in a nutshell: > > > > 1. models - show the db table structure which is used by the views. > > > > 2. templates - allow you to separate html and code - at > > least for the most part > > > > 3. views - contain the functions which interact with the > > models and templates to perform some sort of interaction. > > > > 4. forms - allow data to be input into the website etc.... > > > > I understand the basics but can't for the life of me figure > > out how to make it all work together in a land of joy and > > joyness (ie Charlie the Unicorn vid) > > > > I'm building a UPS rate lookup service. I am including my > > template and form below. > > > > when i visit the page below, only the input button shows... > > no other form elements > > > > > > [template.html] > > > > {% extends "ups_rates/ups_lookup_base.html" %} {% load i18n %} > > > > {% block content %} > > <div class="ups_rate_lookup_back"></div> > > <div class="ups_rate_lookup_header"> > > <span id="upsheader">{% trans "Estimate UPS Shipping > > Rates" %}</ > > span><br /> > > <div class="upsqueryblock"> > > <form method="post" action="."> > > <table> > > {{ form.as_table }} > > </table> > > <input type="submit" name="submit" value="Get Estimate*"> > > </form> > > </div> > > </div> > > > > <div class="upsratedata"> > > this is a place holder for my rates table > > </div> > > > > > > <div class="upsdisclaimerbase"></div> > > <div class="upsdisclaimer"> > > {% trans "* UPS rates presented on this page are > > estimates only based solely on the provided zip-code and not > > your full shipping address. Your final shipping rates will > > be displayed on the payment page when you submit your credit > > card information." %} > > </div> > > <div class="upscloser"><form><input type=button > > value="Close Window" onClick="myPopup()"></form></div> {% endblock %} > > > > > > > > [forms.py] > > > > from django import newforms as forms > > class ziplookup(forms.Form): > > zipcode=forms.CharField(max_length=15, required=True, > > help_text='Please enter your zipcode') > > > > > > > > > > Is there anyone out there who can take me to Candy Mountain > > (another Charlie the Unicorn reference) > > > > > > > > > > > > > > > -- > IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---