objects.create only pupulate few fileds and when called again it populate all the fiedls in DB

14 views
Skip to first unread message

Shrimad Mishra

unread,
Dec 15, 2022, 9:33:08 AM12/15/22
to Django users
When I create an object of model and assign few values to it then the objects get created but only few values get populated but again if I get the created object and assign the values it get populated this time

Anyone have any idea why it is happening

Benjamin Schollnick

unread,
Dec 15, 2022, 9:37:39 AM12/15/22
to django...@googlegroups.com
When I create an object of model and assign few values to it then the objects get created but only few values get populated but again if I get the created object and assign the values it get populated this time

Anyone have any idea why it is happening

Generally speaking this is probably a coding logic error.  The ORM doesn’t pick and chose fields at random to update or save, it saves the fields that you specify in your code.

Without seeing the code, it’s hard to give any specifics.

But generally make sure that your values are completely set before you call for a save.

- Benjamin



--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9d531041-fc01-4c85-8dd5-53da116ffe8an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages