[Answered ]-How do I save a Django Model from request.POST?

2👍

First, I think you’ll be happier of you explicitly make your PK’s into integers.

        loc = Location.objects.get(pk=int(attrs['location']))

Second, you should use a Form.

  1. It validates the fields for you.

  2. It will create the Model object from the Form object.

Read this. http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/

👤S.Lott

Leave a comment