I was totally on the wrong trail!

Hopefully this post can serve others who were in my dilemma:

If you are looking to have a file as part of your model definition,
look here:
http://docs.djangoproject.com/en/dev/topics/files/


Looking in these locations did not supply what I was after:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads
http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/

I don't have it entirely working just yet, but this is what I was
looking to do.

On Jul 8, 11:25 am, Rodion Raskolnikiv <noah...@gmail.com> wrote:
> To be more specific, here is what I have tried:
>
> # in models.py
> from django import forms
>
> class UploadFileForm(forms.Form):
>     title = forms.CharField(max_length=50)
>     file  = forms.FileField()
>
> # in admin.py
> from proj.app.models import UploadFileForm
>
> admin.site.register(UploadFileForm)
>
> Which gives me the error message:
> TypeError at /admin/
> 'DeclarativeFieldsMetaclass' object is not iterable
>
> Am I heading in the wrong direction?
>
> On Jul 8, 10:28 am, 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!

-- 
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.

Reply via email to