#32464: Enable "detaching" of file from FileField and ImageField
-------------------------------------+-------------------------------------
               Reporter:  Samuli-    |          Owner:  nobody
  Petrus Korhonen                    |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  3.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When model contains FileField (or ImageField) cloning an instance by
 setting primarykey to None and saving object leads to problems. It seems
 that the resulting objects refer to same file which is not the desired
 behaviour as this leads to invalid objects.

 It would make sense to have facility to "detach" FileField from file
 without deleting the actual file. After taking a look at the FieldFile
 code I think this functionality would be trivial to add and I would be
 happy to submit a pull request implementing this feature if it has
 sufficient merit to be merged.

 Also, I would like to have feedback on whether maintainers prefer a
 separate "detach" function or if it should be implemented as parameter on
 "delete".

 PS. I could also implement "attach" function if there is need for it.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32464>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.3f8f9b390c23f8db91280edd63f6cfc0%40djangoproject.com.

Reply via email to