Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your code looks correct, largely speaking. I actually ran a "stub" project on my machine using the form and form-creation code you have, with successful results (admittedly, I guessed at what a Profile model might look like).</p> <p>One thing to consider, though it won't affect rendering, is that you should be instantiating the MeetingForm with the dictionary as <code>initial</code> data. If you pass it as the first positional argument, django will assume you mean for that data to be the POST data, and that therefore the form should be validated. (Apologies if you already know this and where just short-cutting for the purposes of posing the question).</p> <p>I often find that django views swallow important errors. To test your form try doing it in the Django shell:</p> <pre><code>$ python manage.py shell &gt;&gt;&gt; from blah.models import Profile &gt;&gt;&gt; from blah.forms import MeetingForm &gt;&gt;&gt; from datetime import date &gt;&gt;&gt; p = Profile.objects.get(id=someid) &gt;&gt;&gt; mf = MeetingForm(initial={'date':date.today(), 'owner':p}) &gt;&gt;&gt; print mf.as_p() </code></pre> <p>This will output the form and, if there are serious explosions, the errors as well.</p> <p>Also, and I know this is silly but I've done stuff like this too :-) (extra set of eyes... etc...), are you sure you're passing the 'form' variable to the context for your template rendering? And that the variable is called 'form', not 'mf' or something like that?</p> <p>Hope that helps</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload