Found the problem, thanks again for all of the help.
It turns out you have to define the extra field above def
__init__(self, *args, **kw) as in:
forms.py
class SomeForm(ModelForm):
checkbox = forms.BooleanField(required=False,
widget=forms.CheckboxInput(), label='some label')
On Apr 7, 6:19 pm, Merrick wrote:
> I appreciate all of the help, I was actually showing both Daniel and
> Raj that their suggestions have been tried to no result. To answer
> your question, look up at Raj's suggestion. My code before and after
> trying the suggestions above,
I appreciate all of the help, I was actually showing both Daniel and
Raj that their suggestions have been tried to no result. To answer
your question, look up at Raj's suggestion. My code before and after
trying the suggestions above, is to have message defined outside of
meta.
Do you have a
On Wed, Apr 7, 2010 at 5:30 PM, Merrick wrote:
> Thank you.
>
> I'll be more specific, here is what I have:
>
> views.py
> -
> ...
> if request.method == 'POST':
> some_form = SomeForm(data = request.POST, request=request,
> instance=somemodel)
> ...
> if
Thank you.
I'll be more specific, here is what I have:
views.py
-
...
if request.method == 'POST':
some_form = SomeForm(data = request.POST, request=request,
instance=somemodel)
...
if some_form.is_valid():
some_form_update = some_form.save(commit=False)
On Apr 7, 4:05 am, Merrick wrote:
> I added a checkbox form field to my template, and I even tried to add
> it in my forms.py and then in my views.py I check for it like so:
>
> if form.cleaned_data['checkbox_field']:
> code to send email...
>
> But when I submit the form I
On Apr 7, 8:05 am, Merrick wrote:
> How should I go about adding a field to a model form
> when the field is not part of the model?
Define a Custom ModelForm by specifying model in Meta and declare the
required addnl field there.
(check-box means boolean, right?). Now set
I added a checkbox form field to my template, and I even tried to add
it in my forms.py and then in my views.py I check for it like so:
if form.cleaned_data['checkbox_field']:
code to send email...
But when I submit the form I get a KeyError. How should I go about
adding a field to a model
8 matches
Mail list logo