Re: Formwizard and manytomany
models.py areaes = models.ManyToManyField(areavaga,verbose_name='Area da vaga*') pret_salario = models.CharField('Pretenção salarial*',max_length=2,choices=SALARIO_C) cargointeresse = models.CharField('Cargo de interesse*',max_length =20) tipoperfil = models.CharField('Tipo de perfil*',max_length=2,choices=TIPOPERFIL_C) forms.py class usuarioForm(forms.ModelForm): class Meta: model = usuario areaes = forms.ModelMultipleChoiceField(queryset=areavaga.objects.all()) pret_salario = forms.ChoiceField(widget=forms.Select(attrs={'class':'validate[required] select-medium'}), choices=SALARIO_C) cargointeresse = forms.CharField(max_length =50, widget=forms.TextInput(attrs={'class':'input-medium validate[required]'})) tipoperfil = forms.ChoiceField(widget=RadioSelect(renderer=HorizRadioRenderer, attrs={'class':'validate[required]'}), choices=TIPOPERFIL_C) formwizard class CadastroWizard(FormWizard): def get_template(self, step): return ['forms/wizard_%s.html' % step] def done(self, request, form_list): data = {} for form in form_list: data.update(form.cleaned_data) user = User( username=data['email'], first_name=data['nome'], email=data['email'] ) user.set_password(data['senha']) user.save() tipo = usuario.objects.create(**data) <<<--- In here! return render_to_response('cadastro-concluido.html', {'data': data}, context_instance=RequestContext(request)) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Formwizard and manytomany
On Fri, Nov 25, 2011 at 12:27 PM, Jawaad Mahmood <jawaad.mahm...@gmail.com> wrote: > On Nov 25, 10:53 am, Arthur Fortes <fortes.art...@gmail.com> wrote: >> Hello, I'm new in Django and I got a problem with a formwizard. My >> manytomany dont works with formwizard. When I try appears this error : >> 'areaes' is an invalid keyword argument for this function. What I >> should do? > > - snip- > > Arthur, could you please include: > > - The original form you are using > - The model that has the "ManyToMany" relationship > - the exact code where you include "areaes"? > > The formwizard, by itself, isn't very helpful. My guess is that you > are passing an odd keyword when initializing it. I'd also ask that you direct this question to django-users. Django-developers is for discussing the development of Django itself. If you want help debugging something, you should be asking on django-users. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Formwizard and manytomany
On Nov 25, 10:53 am, Arthur Fortes <fortes.art...@gmail.com> wrote: > Hello, I'm new in Django and I got a problem with a formwizard. My > manytomany dont works with formwizard. When I try appears this error : > 'areaes' is an invalid keyword argument for this function. What I > should do? - snip- Arthur, could you please include: - The original form you are using - The model that has the "ManyToMany" relationship - the exact code where you include "areaes"? The formwizard, by itself, isn't very helpful. My guess is that you are passing an odd keyword when initializing it. - j -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Formwizard and manytomany
Hello, I'm new in Django and I got a problem with a formwizard. My manytomany dont works with formwizard. When I try appears this error : 'areaes' is an invalid keyword argument for this function. What I should do? So my formwizard is: class CadastroWizard(FormWizard): def get_template(self, step): return ['forms/wizard_%s.html' % step] def done(self, request, form_list): data = {} for form in form_list: data.update(form.cleaned_data) user = User( username=data['email'], first_name=data['nome'], email=data['email'] ) user.set_password(data['senha']) user.save() tipo = usuario.objects.create(**data) return render_to_response('cadastro-concluido.html', {'data': data}, context_instance=RequestContext(request)) Thanks for attention. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.