Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True
Thanks, created Ticket #9039 > I don't think the ModelForm validation should prohibit something the > databases generally allow. I'd open a ticket (search first though to see if > it's already been reported/decided on...I could be missing something). > > Karen > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True
My django version is 1.0-final-SVN-9013 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Form validation problem for model with ForeignKey having unique=True,blank=True,null=True
Hi, I'm having problems validating a form for the below models. Multiple null values in the below "Thing" model's "other" column seem to prevent the basic ModelForm from validating. This also happens for OneToOneFields of the same nature. Normal django db api functions and the database do not seem to have any problem. I also tried this in an older revision of django (using form_for_model) and had no problems there. Is this a known issue? It seems really basic. --- class OtherThing(models.Model): pass class Thing(models.Model): other = models.ForeignKey('OtherThing', null=True, blank=True, unique=True) >>> import django >>> django.get_version() >>> from django.forms import ModelForm >>> from test.models import * >>> >>> class ThingForm(ModelForm): ... class Meta: ... model = Thing ... >>> Thing.objects.all() [] >>> ThingForm({}).save() >>> ThingForm({}).save() Traceback (most recent call last): File "", line 1, in ? File "/home/griswold/lib/python/django/forms/models.py", line 302, in save return save_instance(self, self.instance, self._meta.fields, fail_message, commit) File "/home/griswold/lib/python/django/forms/models.py", line 36, in save_instance raise ValueError("The %s could not be %s because the data didn't" ValueError: The Thing could not be created because the data didn't validate. >>> >>> Thing.objects.create() >>> Thing.objects.create() >>> Thing.objects.all() [, , ] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: OneToOneField value not selected in default html form
Oops, i thought I was running 1.0, but i thought wrong. Thanks -nate On Wed, Sep 10, 2008 at 9:45 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Wed, Sep 10, 2008 at 8:21 PM, nate <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> The values of OneToOneFields don't appear to remain selected after >> creation or update in default forms (such as those used by the admin >> interface). I Looked for a bug report but didnt see one. Has anyone >> else run into this? >> >> Take the following set of models: >> >> class Thing1(models.Model): >>name = models.CharField(max_length=20) >> >> [...] >> class OTOTest(models.Model): >>other = models.OneToOneField('Thing1') >> >> [...] >> >> --- >> >> Now, creating an OTOTest with a Thing1, and clicking save and continue >> editing, will present a form with "-" selected (not the Thing1 >> that you just set). >> [...] > > > What level of Django are you running? This was a problem fixed very soon > before 1.0 was released, see: http://code.djangoproject.com/ticket/8694 > > Karen > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---