Example #1
0
def curations_for_group_html(request, object_id, template_name="depot/curations_for_group_embed.html"):

    object = get_one_or_404(obj_class=Account, id=ObjectId(object_id))
    curations = [c.resource for c in Curation.objects(owner=object).order_by("-item_metadata__last_modified")[:10]]
    template_context = {"object": object, "curations": curations}

    return render_to_response(template_name, template_context, RequestContext(request))
Example #2
0
 def render(self, context):
     owner = self.owner.resolve(context)
     # context[self.varname] = list(Resource.objects(curations__owner=owner)[:int(self.num)])
     context[self.varname] = [
         c.resource for c in Curation.objects(owner=owner).order_by(
             '-item_metadata__last_modified')[:int(self.num)]
     ]
     return ''
Example #3
0
def curations_for_group(request, object_id, template_name="depot/curations_for_group.html"):
    """docstring for curations_for_group"""
    object = get_one_or_404(obj_class=Account, id=object_id)

    # curations = list(Resource.objects(curations__owner=object)[:10])
    curations = [c.resource for c in Curation.objects(owner=object).order_by("-item_metadata__last_modified")[:10]]

    template_context = {"object": object, "curations": curations}

    return render_to_response(template_name, template_context, RequestContext(request))
Example #4
0
def curations_for_group_html(request, object_id, template_name='depot/curations_for_group_embed.html'):

    object = get_one_or_404(obj_class=Account, id=ObjectId(object_id))
    curations = [c.resource for c in Curation.objects(owner=object).order_by('-item_metadata__last_modified')[:10]]
    template_context = {'object': object, 'curations': curations}

    return render_to_response(
        template_name,
        template_context,
        RequestContext(request)
    )
Example #5
0
def curations_for_group_js(request, object_id, template_name="depot/curations_for_group_embed.js"):

    object = get_one_or_404(obj_class=Account, id=ObjectId(object_id))
    curations = [c.resource for c in Curation.objects(owner=object).order_by("-item_metadata__last_modified")[:10]]
    base_url = Site.objects.get_current().domain
    print base_url
    template_context = Context({"object": object, "curations": curations, "base_url": "http://%s" % base_url})

    response = HttpResponse(mimetype="text/javascript")
    t = loader.get_template(template_name)
    response.write(t.render(template_context))
    return response
Example #6
0
def curations_for_group_js(request, object_id, template_name='depot/curations_for_group_embed.js'):
    
    object = get_one_or_404(obj_class=Account, id=ObjectId(object_id))
    curations = [c.resource for c in Curation.objects(owner=object).order_by('-item_metadata__last_modified')[:10]]
    base_url = Site.objects.get_current().domain
    print base_url
    template_context = Context(
        {'object': object, 'curations': curations, 'base_url': 'http://%s' % base_url})

    response = HttpResponse(mimetype='text/javascript')
    t = loader.get_template(template_name)
    response.write(t.render(template_context))
    return response
Example #7
0
 def test_curations(self):
     """docstring for test_curations"""
     
     
     acct = Account.objects.get(name="Derek Hoy")
     print acct, acct.id
     
     print list(Resource.objects(curations__owner=acct))
     
     
     curations = Curation.objects(owner=acct).order_by('-item_metadata__last_modified')
     
     for c in curations:
         print c.owner, c.item_metadata.last_modified,  c.resource
Example #8
0
 def test_curations(self):
     """docstring for test_curations"""
     
     
     acct = Account.objects.get(name="Derek Hoy")
     print acct, acct.id
     
     print list(Resource.objects(curations__owner=acct))
     
     
     curations = Curation.objects(owner=acct).order_by('-item_metadata__last_modified')
     
     for c in curations:
         print c.owner, c.item_metadata.last_modified,  c.resource.title
Example #9
0
def curations_for_group(request,
                        object_id,
                        template_name='depot/curations_for_group.html'):
    """docstring for curations_for_group"""
    object = get_one_or_404(obj_class=Account, id=object_id)

    # curations = list(Resource.objects(curations__owner=object)[:10])
    curations = [
        c.resource for c in Curation.objects(
            owner=object).order_by('-item_metadata__last_modified')[:10]
    ]

    template_context = {'object': object, 'curations': curations}

    return render_to_response(template_name, template_context,
                              RequestContext(request))
Example #10
0
 def render(self, context):
     owner = self.owner.resolve(context)
     # context[self.varname] = list(Resource.objects(curations__owner=owner)[:int(self.num)])
     context[self.varname] = [c.resource for c in Curation.objects(owner=owner).order_by('-item_metadata__last_modified')[:int(self.num)]]
     return ''