Is there a reason why you inherit from forms.Form, but not forms.ModelForm ? Is it successfully finding ModelForm without the reference to forms?
-Rob On Tue, Jan 25, 2011 at 12:41 PM, MikeKJ <mike.jo...@paston.co.uk> wrote: > > class CertForm(forms.Form): > agree = forms.BooleanField(required=True, label="I confirm the above and > agree.") > cert = forms.BooleanField(required=False, label="I require a > certificate") > > class UserAccountForm(ModelForm): > class Meta: > model = UserAccount > > class VideoAccountForm(ModelForm): > class Meta: > model = VideoAccount > > def certificate(request, id): > if not request.user.is_authenticated(): > return HttpResponseRedirect('/user/login/') > person = request.user > check = UserProfile.objects.get(username=person) > if check.approved_member and check.gp: > part_vid = Part.objects.get(pk = id) > cost = round((part_vid.runtime/60)*10,2) > if request.POST: > form = CertForm(request.POST) > userform = UserAccountForm() > videoform = VideoAccountForm() > if form.is_valid(): > //normal form.cleaned_data stuff > // userform > data = {'user_id': 'check.id', > 'user_name': 'check.name', > 'user_email': 'check.email', > 'video_id': 'part_vid.id', > 'video_name': 'part_vid.title', > 'video_time': 'part_vid.runtime', > 'video_cost': 'cost' > } > userform.save(data) > // videodata > vdata = {'video_id': 'part_vid.id', > 'video_name': 'part_vid.title', > 'video_time': 'part_vid.runtime', > 'video_cost': 'cost', > 'lecturer_id': 'k', > 'lecturer_name': 'lecturer_name' > } > videoform.save(vdata) > > return HttpResponseRedirect(reverse('video.views.play_vid', > args=(cat_id, this_vid_id,))) > else: > form = CertForm(request.POST) > > all the stuff in data and vdata is derived from query sets prior to the > form > > Q > 1 Why am I getting "'UserAccountForm' object has no attribute > 'cleaned_data'" > 2 If I use if userform.is_valid() then userform is invalid in any case > 3 Just save the data given to another model 'Accounts' is all I want it to > do but it has to be done in here as this is where the agree is done > -- > View this message in context: > http://old.nabble.com/what-am-I-doing-wrong--tp30760259p30760259.html > Sent from the django-users mailing list archive at Nabble.com. > > -- > 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+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Robert McQueen Massachusetts Institute of Technology Class of 2012, Course 6.3 - Computer Science rmcqu...@mit.edu -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.