wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

How are FileFields supported in django-tastypie-mongoengine? #47

Closed alok25 closed 11 years ago

alok25 commented 11 years ago

I can see reference field, embedded document field, listfield of embedded document field, etc. but didn't see FileField. Is it supported?

mitar commented 11 years ago

No, they are not supported. There first have to be support in TastyPie for it.

alok25 commented 11 years ago

but i saw file field in tastypie(https://django-tastypie.readthedocs.org/en/latest/fields.html?highlight=fields#filefield)

mitar commented 11 years ago

What would you like to use the file field for? File upload?

alok25 commented 11 years ago

I would like to upload an image (in future, video file may be) file into mongodb. I'm able to send all other type of fields(List, Embedded, Reference, List of Emb/Ref/ etc). This plugin has been a lifesaver for me till now.

mitar commented 11 years ago

So, please make an example in TastyPie itself how to upload a file and then we can discuss how to store that into MongoDB.

alok25 commented 11 years ago

I think I'm a bit confused here. You want an example in tastypie file upload ? or django file upload? Tastypie file upload is essentially my requirement.

mitar commented 11 years ago

As I said, django-tastypie-mongoengine just extends TastyPie with MongoDB backend. Show me that TastyPie can support file uploads with some other backend and then we can add support for file uploads to MongoDB backend. I am arguing that TastyPie does not support file upload so we cannot do much here yet. And you are saying it does support file uploads. So please show me.

nim4n commented 9 years ago

this is an example of tastypie code for filefield how can I do it in mongo backend? http://django-tastypie.readthedocs.org/en/latest/fields.html#filefield

class ExcelResource(MultipartResource, ModelResource):
    file_field = fields.FileField(attribute="file_field")

    class Meta:
        queryset = Excel.objects.all()
        resource_name = 'excel'
        authorization = DjangoAuthorization()
        authentication = MultiAuthentication(BasicAuthentication(), SessionAuthentication())
        always_return_data = True
        list_allowed_methods = ['post']