django on model create code example
Example 1: django createmany
>>> Category.objects.all().count()
2
>>> Category.objects.bulk_create(
[Category(name="God"),
Category(name="Demi God"),
Category(name="Mortal")]
)
[<Category: God>, <Category: Demi God>, <Category: Mortal>]
>>> Category.objects.all().count()
5
Example 2: create django object
Author.objects.create(name="Joe")
Example 3: .save() in django
>>> one_entry = Entry.objects.get(pk=1)