Actually, maybe I spoke too soon.  It seems that the option still has
to be hard-coded into the models.py file initially -- that's what I
was hoping to avoid.  I wanted the designer/user to just be able to
add a new key/value pair in the admin, and then access it in the
template without having to "re-code" any of the python.

On Jul 4, 2:02 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 4, 1:27 pm, Damon Timm <damont...@gmail.com> wrote:
>
>
>
> > Hello everyone -
>
> > I wondered if anyone had insight on a Model for site-wide "global"
> > options.  I am thinking of a place to store: site title, site meta,
> > site description, specific global links (twitter, facebook, etc),
> > support contact email, etc ... The model itself doesn't seem too
> > complicated, maybe:
>
> > class GlobalOptions(models.Model):
> >     opiton = models.SlugField('Machine Readable Option
> > Name',max_length=50,unique=True)
> >     value = models.TextField('Option Value')
> >     # more fields could be included, of course (date_created, description, 
> > blah)
>
> > My question, though, is about how to easily get these new "options"
> > into a template tag.  So that I could simply do:
>
> > {{ globaloptions.optionname }}
>
> > And it would return the value for that option or, if the option didn't
> > exist, it would return nothing.  I have been looking around for a way
> > to do this and coming up blank -- I am new to both Python and Django,
> > so I'm sure the answer is there, I just don't know where/how to look
> > for it.
>
> > Any insight would be great!
>
> > Damon
>
> Look into the django-dbsettings project, which does just 
> this:http://code.google.com/p/django-values/
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
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