In Django 0.96 I was able to do something along the lines of:

def list_doohickies(request):
    return list_objects(request, 'doohickies', 'doohicky')

def list_objects(request, app_label, model_name, reqd_permission):
    model = models.get_model(app_label, model_name)
    if model is None:
        raise Http404("App %r, model %r, not found" % (app_label,
model_name))

    cl = ViewList(request, model)
    c = template.RequestContext(request, {
        'title': cl.title,
        'is_popup': cl.is_popup,
        'cl': cl,
    })

    return render_to_response(['view_list.html'], context_instance=c)

Sadly, this broke badly in Django 1.x.

I would love to find out how to do this in 1.x... Anyone out there
have any ideas?

--gsiems

On Jan 27, 2:05 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, Jan 27, 2009 at 2:00 PM, bobhaugen <bob.hau...@gmail.com> wrote:
>
> > Anybody done anything like:
> > a) using the django admin change_list filters directly in custom views
> > and templates outside of admin?
> > or
> > b) created something *like* the admin change_list filters for use in
> > custom views and templates outside of admin?
> > or
> > c) got any tips on the simplest way one could do such a thing?
>
> Yes, been there done that about 2.5 years ago when I started with Django and
> wanted similar functionality for my own non-admin pages.   As I was also
> brand-new to Python it was a good exercise in figuring out where the code
> was that did it, how it worked, and what I needed to do to to create similar
> function for my own use.  If I were to encounter the problem today I might
> try to approach it in a way to make that code more generally re-usable.
> However, that was more than I could tackle at the time and I haven't had to
> revisit that code in at least 2 years so all I can say is as I recall it
> wasn't too hard to figure out what admin was doing and borrow/adapt the code
> for use in my own project.
>
> Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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