Re: is my UserProfile ManyToMany wrong?

2012-02-12 Thread Patrick Wellever
Hi, Is that code all that's in your model classes, or just an excerpt? If you don't already have a __unicode__() method defined on your model, I think that would cause the problem you are referring to. That method would be called by Django in various places, wherever it needs to represent a model

Re: Generating a list of available templates

2012-02-11 Thread Patrick Wellever
Thanks for weighing in, that is helpful, and last night I was playing around with a somewhat similar approach. It's not exactly what I was hoping for, because it still isn't really integrated with the way Django uses template loaders. This solution works for TEMPLATE_DIRS and INSTALLED_APPS, bu

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Thanks for the reply. Yes, this wouldn't be too tough if the directories in TEMPLATE_DIRS were all I had to worry about, but the glitch I mentioned earlier is that Django can also look for templates in places other than those listed explicitly in that setting. For example, the template loader

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Sorry... I think that's a little more complicated than what I need, actually. Django already handles searching for the template in all the right locations, so I don't have any problem actually rendering the template, and I shouldn't need to worry about absolute paths. Here's a simplified bit of cod

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
; software.buy.des...@gmail.com> wrote: > I think you have it with the syntax you just wrote down. > > I will be available by phone until 4:45 if you want to call. > > 781-... > > On Feb 10, 4:19 pm, Patrick Wellever wrote: > > > > I need some

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Sorry, this question is turning out to be much more difficult to articulate than I originally expected. Thanks for bearing with me. ;) You definitely have the right idea of what I'm trying to do -- the only problem with this method is that Django looks for templates in multiple places, so I don't

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Sorry to be unclear... Basically the functionality I want is just like in contrib.flatpages -- the model has a field called 'template' that allows the user to specify an alternate template for the object detail page. But in the flatpages app, the field is just a charfield, so the user has to kn

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Right, I understand the loader works this way… What I'm trying to do is generate a list of 'choices' for a model field that populates itself automatically with available templates in a given directory, that works regardless of whether the specified directory is on a template path specified in t

Re: Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Thanks, I think that gets me most of the way there, but the part I'm having more trouble with is figuring out how to deal with the other template loaders, such as 'django.template.loaders.app_directories.Loader', that don't pull from the 'TEMPLATE_DIRS' setting. I'd like the solution to take tho

Generating a list of available templates

2012-02-10 Thread Patrick Wellever
Hi all, An app I'm working on has a model that, similar to the Flatpages app model, has a "template" field to allow users to specify an alternate template for displaying the object detail view. What I'd like to do though is to make this a choice field that pulls its options dynamically from a