On Oct 7, 2008, at 8:29 AM, Mariana Romão wrote:

> Hi,
> I'm new in the group and in the use of Dajngo too.
> I'm developing an application that needs storage files ".py" in  
> database (and maybe other types of files). I thought Django did this  
> "automatically" when I define the field in the model as FileField,  
> but I realized that what does is put in database a column as a  
> varchar.
>
> What I need do for that the database storage the file? Create other  
> table or other column manually?

If all you're doing is serving those files, don't put them in the  
database. There are more efficient ways to do that, even if you  
require authentication or other special handling.

If you're doing something more interesting with them, then two  
approaches spring to mind. You could look into writing a custom  
Storage implementation to save them into the database (see 
http://docs.djangoproject.com/en/dev/ref/files/storage/) 
, or you could just add a FileField to your form instead of your  
model, and in the form's save method, read the file contents into a  
TextField on your model.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to