Hello,

I would like to ask how i should correctly deal with OneToOne (OTO)
relation field .
When i create object from model with OTO fields i do not want to
assign any model to them. Maybe i will do in future when appropriate
object will appear.

Django do not let me to have not assigned OTO fields. At least i have
to create empty OTO object.

class Word(models.Model):
WwLksOTO=models.OneToOneField(Lks, related_name='WwmainLks',
blank=True, default='')## for input, goes to LinkModel and WordLinkMM
field

    def save(self, *args, **kwargs):
        if not self.id:
                self.WwLksOTO=Lks.objects.create()
        super(Word, self).save()

Now i just create LksOTO in save, since otherwise django generates the
error.

-- 
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.

Reply via email to