from egonomy.models import Fragment
from tastypie import fields
from tastypie.resources import ModelResource



class FragmentResource(ModelResource):
    image = fields.ForeignKey("egonomy.api.resources.image.ImageResource", 'image')
    class Meta:
        allowed_methods = ['get']
        resource_name = 'fragments'
        queryset = Fragment.objects.all()
#        filtering = {
#            'tags' : ALL_WITH_RELATIONS,
#            'title' : ALL,
#        }
    
#    def get_object_list(self, request):
#        return Image.objects.select_related('info', 'metadata').all()

#    def prepend_urls(self):
#        return [
#            url(r"^(?P<resource_name>%s)/recommended/$" % self._meta.resource_name, self.wrap_view('get_recommended'), name="api_contents_recommended"),
#            url(r"^(?P<resource_name>%s)/(?P<iri_id>[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),            
#        ]
        
            