Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2015-10-08 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 The reason this was originally closed is because you can do this:
 {{{
 obj.file.save(content.name, content, save=False)
 obj.save(update_fields=['file'])
 }}}
 This seems acceptable to me.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.fb164596e595a4ad8e55daac640987d4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2013-06-08 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by anonymous):

 * keywords:  django 1.5 =>
 * version:  1.5 => master


Comment:

 As the expected release of Django 1.6, can we see this feature in it?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.4c56ac5cbb7550b25ec4a6eb8e87a72f%40djangoproject.com?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2013-04-07 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  django 1.5   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by Alex):

 * stage:  Design decision needed => Accepted


Comment:

 Marking as accepted, the ability to not save all the things makes sense.
 Not sure if it should be the default or an option yet.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2013-04-04 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Design
 Keywords:  django 1.5   |  decision needed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by anonymous):

 * version:  1.5-alpha-1 => 1.5


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2013-04-04 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:
  (models, ORM)  |  1.5-alpha-1
 Severity:  Normal   |   Resolution:
 Keywords:  django 1.5   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by 3dflex@…):

 * status:  closed => new
 * resolution:  duplicate =>


Comment:

 There is no such option in FieldFile.save
 
(https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.fields.files.FieldFile.save)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2013-04-04 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:
  (models, ORM)  |  1.5-alpha-1
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  django 1.5   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by jacob):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 This ticket's effectively obsoleted by `update_fields` in Django 1.5
 (https://docs.djangoproject.com/en/dev/ref/models/instances/#specifying-
 which-fields-to-save).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2012-11-05 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:
  (models, ORM)  |  1.5-alpha-1
 Severity:  Normal   |   Resolution:
 Keywords:  django 1.5   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by akaariai):

 * stage:  Unreviewed => Design decision needed


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2012-10-29 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:
  (models, ORM)  |  1.5-alpha-1
 Severity:  Normal   |   Resolution:
 Keywords:  django 1.5   | Triage Stage:
Has patch:  0|  Unreviewed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by anonymous):

 * version:  master => 1.5-alpha-1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2012-10-27 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  django 1.5   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by anonymous):

 * version:   => master
 * stage:  Design decision needed => Unreviewed


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2012-10-26 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Design
 Keywords:  django 1.5   |  decision needed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by 3dflex@…):

 This is useful when you need to update the field contains id in the
 name(path), which can be obtained after the save. Now we can do:


 {{{
 def get_files_path(instance, filename):
 return os.path.join('files', str(instance.id), filename)

 class MyFile(models.Model):
 ...
 file = models.FileField(upload_to=get_files_path)
 }}}



 {{{
 model.save()
 model.file.save(content.name, content)
 }}}


 The second query repeatedly update all fields, which is not acceptable
 when the data and fields to save is more.

 Sorry for my English :)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19193: Save only one field to database which refereced to FieldFile

2012-10-26 Thread Django
#19193: Save only one field to database which refereced to FieldFile
-+-
 Reporter:  3dflex@… |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Design
 Keywords:  django 1.5   |  decision needed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by lrekucki):

 * needs_docs:   => 0
 * stage:  Unreviewed => Design decision needed
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Old description:

> 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

New description:

 `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

--

Comment:

 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.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.