Hi Richard,
Yes, my way is pretty hacky. The proper way is to get the instance from the
form.save() method like you mentioned.
Collin
On Monday, January 12, 2015 at 10:58:46 AM UTC-5, Richard Brockie wrote:
>
> Hello again Collin,
>
> I am using your example as the basis for another similar
Hello again Collin,
I am using your example as the basis for another similar set of forms and I
spotted something subtle that passed me by the first time through.
Namely, that to save the data, you are calling the model.save() method,
rather than the form.save() method that is generally shown
Hi Collin,
Thanks again for the suggestion - I have the bare-bones version working in
my code. Now to add in race_number validation and pretty up the form...
R.
On Sunday, January 4, 2015 11:41:36 AM UTC-8, Collin Anderson wrote:
>
> Hi,
>
> If the field on the model is already blank=True,
Hi Collin,
Yes, you've answered my main question which was how to go about the
implementation. I'll need to go through the details anyway, but you have
given me a good start.
Thanks again,
R.
On Sunday, January 4, 2015 11:41:36 AM UTC-8, Collin Anderson wrote:
>
> Hi,
>
> If the field on the
Hi,
If the field on the model is already blank=True, then you don't need that.
Also, I realized my (completely untested :) code doesn't exactly match the
behavior you want, but I hope it's a good enough start. You may need to
store a reference to the original race_number to decide if you need
Hi Collin,
Thanks very much for the advice. I'll be getting to this part of my
development in the next few days and will report back when I have things
working.
One question in the meantime - what does this line do given that my model
will already explicitly not require the race_number?
Hi,
Your case is complicated enough that I'd actually recommend not using
formsets here and processing a list of plain ModelForms yourself in the
view. I bet formsets will ending out getting in your way.
Here's a some messy code:
class EntryForm(forms.ModelForm):
race_number =
Hi,
I have the following pseudo model that I will use as the basis of a
modelformset:
class Entry:
athlete = ForeignKey(athlete)
category = ForeignKey(category)
race_number = IntegerField
I have a page that displays each athlete's details so the choice of athlete
has already been
8 matches
Mail list logo