I use modelform. All works fine. Validation is ok and I want to save my form. Before saving I need to populate user_id into my modelform so i make something like this:if form.is_valid():obj = form.save(commit=False)obj.user = request.userobj.save()It seems to be ok. Form is saved to DB BUT!: I usecategories = models.ManyToManyField(Category) When I use the method above - categories aren't saved into DB :(When I do form.save() - categories are added but User object not :(Am I something missing?
This is explicitly documented here:
http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/#the-save-method
(third paragraph after the green box).
--
DR.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment