I misread the docs. save() looks great.


On Wed, Jan 29, 2014 at 1:42 PM, David Ormsbee <notifications@github.com>wrote:

> In apps/submissions/api.py:
>
> > +    model_kwargs = {
> > +        "student_item": student_item_model,
> > +        "answer": answer,
> > +        "attempt_number": attempt_number,
> > +    }
> > +    if submitted_at:
> > +        model_kwargs["submitted_at"] = submitted_at
> > +
> > +    try:
> > +        validation_data = model_kwargs.copy()
> > +        validation_data["student_item"] = student_item_model.pk
> > +        submission_serializer = SubmissionSerializer(data=validation_data)
> > +        submission_serializer.is_valid()
> > +        if submission_serializer.errors:
> > +            raise SubmissionRequestError(submission_serializer.errors)
> > +        submission = Submission.objects.create(**model_kwargs)
>
> Is there a reason to prefer this over submission_serializer.save()?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/edx/edx-tim/pull/14/files#r9278279>
> .
>