> I thought that I could add in some additional information to a form > before it gets saved as a new object in the database but the following > isn't working: > > def groupadd(request): > > if request.method == 'POST': > form = GroupForm(request.POST) > if form.is_valid(): > data = form.cleaned_data > data['group_owner'] = request.user.id > data['group_members'] = request.user.id > data['group_admins'] = request.user.id > > newform = GroupForm(data)
Rough guess, but I think you'll need to run .is_valid() again here to trigger validation. You just created another form, which has not yet been validated. > > newform.save > > newform = GroupForm() > return HttpResponseRedirect("/group/list/") > else: > form = GroupForm() > return render_to_response('groups/group_add.html', {'form': form}) > > > It doesn't return any error and it doesn't save the new object. Is > there anyway of sending additional data with a form? --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---