On Monday, 28 July 2014 15:46:11 UTC+1, Tom Evans wrote:
>
> <snip>
>
> You can use kwargs, but it is much cleaner and less typing to use
> Model.objects.create() as you can omit the subsequent save() as
> create() creates valid objects (they have pks).
>
>
You're right as far as that goes, but note that OP is using a ModelForm: so
there is an even easier method.
form = create_insp_m(request.POST)
if form.is_valid():
insp = form.save()
that way they can get rid of all the stuff involving `cleaned_data`, and
even the querying for the Pad object, as the ModelForm does it all already.
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/cbf9eb43-f3cf-43cc-8733-df40c801ac97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.