Home > Software design >  Example of updating fields without views.py?
Example of updating fields without views.py?

Time:09-02

Can you please provide an example of vievs.py updating(or crating) fields without using forms.py?

CodePudding user response:

Here you go. Please, next time, do some research.

Just searching "django update or create" will give you a very nice django doc to the queryset method.
obj, created = Person.objects.update_or_create(
    first_name='John', last_name='Lennon',
    defaults={'first_name': 'Bob'},
)
  • Related