meppum wrote: > I've run into a funny case and I'm not sure how to best deal with it. > Basically, I have the following classes. > > class Profile(models.Model): > name = models.CharField() > foo = models.PositiveIntegerField(blank=True, default=0) > > class RegistrationForm(forms.Form): > name = forms.CharField() > foo = forms.IntegerField(min_value=0, max_value=55, > required=False) > > def save(self): > Profile.objects.create(name=name, foo=foo)
I think you want to change that to: Profile.objects.create(name=self.cleaned_data['name'], foo=self.cleaned_data.get('foo', 0)) -RD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---