Opened 12 years ago

Last modified 9 years ago

#19193 closed New feature

Save only one field to database which refereced to FieldFile — at Version 1

Reported by: 3dflex@… Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Łukasz Rekucki)

django.db.models.fields.FieldFile:

def save(self, name, content, save=True):
....
    if save:
        self.instance.save(update_fields=[self.field.name])
....

or:

def save(self, name, content, save=True, **kwargs)
....
    if save:
        self.instance.save(**kwargs)
....

So, we get rid of re-saving fields when updating

Change History (1)

comment:1 by Łukasz Rekucki, 12 years ago

Description: modified (diff)
Triage Stage: UnreviewedDesign decision needed

Option 1 is highly backwards incompatible and option 2 looks like an API bloat - passing save=False and calling instance.save() does exactly the same and avoids potential kwargs naming conflict.

Note: See TracTickets for help on using tickets.
Back to Top