On Thu, Jul 30, 2015 at 10:40 AM, user07285 <j.arevathi@gmail.com> wrote:
> I have a model and have added a Form FileField to take a file and save all
> their contents for a particular object. The FileField doesn't need to be in
> the database hence not added as a model.fileField. The content from the file
> should be read , parsed and added to the synonym_type.
first of all, it's almost always a _terrible_ idea to save files in
database fields. Yes, it works, no, it's not "faster"; it creates a
heavy overhead on an already sensitive part of your system.
but, if you want to do it, the easiest way is to use a Storage Object
that manages the saving and thus you can keep the FieldFile
abstraction (either from a FileField or a File() object). Even
better, when you get to migrate to a different (better!) storage, you
only have to modify the settings and the code can stay the same.
check DjangoStorages [1], it includes a "Database" backend [2] (and
other like S3, libcloud, etc)
[1] https://django-storages.readthedocs.org/en/latest/index.html
[2] https://django-storages.readthedocs.org/en/latest/backends/database.html
--
Javier
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFkDaoR4JMENcuHmTBxJApEG_nMC8sUCs92n%2B4QJ6iixckF8Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment