Hi,

Can you please describe why you did not want to call author.save()
explicitly?
What is wrong with this approach?

Regards,
Constantine C.

On Mon, Dec 4, 2017 at 7:36 PM, Priyanka Thakur <priyanka.t...@gmail.com>
wrote:

> Hi,
>
>
> I want to create a bunch of objects that are interconnected in my  model
> (eg, one Book and one Author object) and then call save() on  the Book
> object to add everything to the database. In other words, I  don't want to
> save Author object explicitly.
>
> Example:
>
> class Author(models.Model):
>       name = models.CharField(max_length=255L, blank=True)
>
>
> class Book(models.Model):
>     author = models.ForeignKey(Author)
>
>
> I want to do:
>
>
> author = Author('Robert Frost')
>
> book = Book(author)
>
> book.save()
>
> Can this be done in Django 1.10 ?
>
> Regards,
> Priyanka
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/db02ab72-45a3-4f5d-a256-3a32bb4a35d7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/db02ab72-45a3-4f5d-a256-3a32bb4a35d7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Sincerely yours,
Constantine C

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK52boXJeP-ACPxWuY804ZE%2BvXnpiwu9DgBm9eAU0Dng%2BkPhfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to