Soo easy... Thanks for the tips! I knew that there had to be a simple solution!!
On Jul 8, 2:02 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Jul 8, 6:28 pm, Rodion Raskolnikiv <noah...@gmail.com> wrote: > > > > > > > Good morning! > > I have been wanting to design a model (to be administered via the > > admin area) which would allow for file uploads. I have not been able > > to grasp a singular, simple approach to this. Perhaps things are > > complicated by Django's preference for serving media files under a > > different domain, but this is pretty crucial to my project and I was > > hoping that someone could point me in the right direction. > > > This post seems most > > helpful:http://groups.google.com/group/django-users/msg/02cf3d1a838e7e46 > > > but I don't want to blindly copy it and end up with a batch system! I > > am just looking to make a simple file uploader. > > > The model might look like this: > > > class UploadedFile(models.Model): > > title = models.CharField(max_length=250) > > file = forms.FileField() # I don't know if this is how to define > > it > > file_type = models.CharField(max_length=25) > > date_created = models.DateTimeField() > > > I am a huge fan of Python and Django, and I am often surprised by how > > simple and elegant the solutions are, my problem is usually that I am > > trying to do things the difficult way... > > > Any assistance would be greatly appreciated! > > The documentation for file uploads is indeed complicated, but in order > to enable file uploads in the admin you don't need to worry about any > of that. > > However you seem to be trying to declare a form field within a model. > You should of course use the models.FileField, which is fully > documented > here:http://docs.djangoproject.com/en/1.2/ref/models/fields/#filefield > Note that the only thing you *need* to do is to set a value for > upload_to. > -- > DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.