[FUN] Uncyclopedia

2005-10-04 Thread Carlo C8E Miron
Hi Djangonauts™, Have you seen http://uncyclopedia.org/wiki/Django and especially http://uncyclopedia.org/wiki/Django_gods ? ROFL -- Carlo C8E Miron, ICQ #26429731 -- Disclaimer: If I receive a message from you, you are agreeing that: 1. I am by definition, "the intended recipient". 2. All inform

Model subclass accessing parent instances?

2005-10-04 Thread Andy Shaw
Hi all; I'm experimenting with subclassing models at the moment. Specifically, I'm trying to add an optional element to the user class. The following code works fine: from django.core import meta from django.models.auth import User class MyUser(User): about = meta.TextField(blank=Tr

Re: Template guide -> administration feature.

2005-10-04 Thread kmh
On 10/5/05, JKR <[EMAIL PROTECTED]> wrote: > > i'm able to see tags, filter and models. but nothing under view? is > this normal when I'm using generic view. View info only shows up if you have added the setting: ADMIN_FOR = ['myproject.settings.main'] which lists the settings files for the sit

Re: Referencing MEDIA_URL from templates

2005-10-04 Thread kmh
Some examples of use (mis-use?) cases for making settings accessible to templates: 1. To avoid hard coding media url domains in your templates when you're moving between different test and production server setups. 2. To use, for example, the ADMIN_EMAIL setting in a generic error template that

Re: Template guide -> administration feature.

2005-10-04 Thread JKR
Thanks for the helps, No link from admin page, but i got it work under /admin/doc/ link. it required a python-docutils installed in order to view this page. i'm able to see tags, filter and models. but nothing under view? is this normal when I'm using generic view. Johny

Re: Referencing MEDIA_URL from templates

2005-10-04 Thread Maniac
Adrian Holovaty wrote: Right now, there's no other way to get to MEDIA_URL, because it's intended to be used only by the FileFields. Out of curiosity, what's your use case for using it otherwise? For the same thing that admin site uses admin_media: referencing stylesheets and javascripts.

Re: Referencing MEDIA_URL from templates

2005-10-04 Thread kmh
I either do something like this: --- class SettingsNode(Node): def render(self, context): from django.conf import settings context['settings'] = settings return '' def do_put_settings(parser, token): """ Put the site settings into the context as 'settings'. Usa

Re: Referencing MEDIA_URL from templates

2005-10-04 Thread Adrian Holovaty
On 10/4/05, Maniac <[EMAIL PROTECTED]> wrote: > What's the recommended (if any) way to reference MEDIA_URL defined in > settings file from templates? MEDIA_URL is used by all FileFields to give their objects a get_FOO_url() method. See this page: http://www.djangoproject.com/documentation/db_api

Re: Site-wide User Authentication

2005-10-04 Thread Adrian Holovaty
On 10/4/05, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > On Oct 4, 2005, at 8:42 AM, Andreas wrote: > > What's the best way to check if a user is logged in on every page > > (read: view) of a website? I'd like to be able to display the username > > in the template if a user is logged in. At the

Re: Referencing MEDIA_URL from templates

2005-10-04 Thread Maniac
Matt wrote: good question. looking at the {% debug %} output I'd hoped that this would work: {{ myproject.settings.main.MEDIA_URL }} It doesn't look to me that it should... Those modules in debug aren't in a Context, they are in a different dict that I suspect is not available outside of

Re: Referencing MEDIA_URL from templates

2005-10-04 Thread Matt
good question. looking at the {% debug %} output I'd hoped that this would work: {{ myproject.settings.main.MEDIA_URL }} but it doesn't output for me.

Re: Template guide -> administration feature.

2005-10-04 Thread Jacob Kaplan-Moss
On Oct 4, 2005, at 3:20 PM, JKR wrote: In the template guide, there is a statement that referring to feature in administration interface. """ Because Django can be used to develop any sort of site, the tags, filters and variables available are different depending on the application. To make it

Re: Site-wide User Authentication

2005-10-04 Thread Jacob Kaplan-Moss
On Oct 4, 2005, at 8:42 AM, Andreas wrote: What's the best way to check if a user is logged in on every page (read: view) of a website? I'd like to be able to display the username in the template if a user is logged in. At the moment, I'm using the following code: If you use django.core.extens

Template guide -> administration feature.

2005-10-04 Thread JKR
Hi, In the template guide, there is a statement that referring to feature in administration interface. """ Because Django can be used to develop any sort of site, the tags, filters and variables available are different depending on the application. To make it easy to figure out what's available

Referencing MEDIA_URL from templates

2005-10-04 Thread Maniac
What's the recommended (if any) way to reference MEDIA_URL defined in settings file from templates? Admin site uses custom template tag for it. Is there anything similar for general usage in projects?

Site-wide User Authentication

2005-10-04 Thread Andreas
What's the best way to check if a user is logged in on every page (read: view) of a website? I'd like to be able to display the username in the template if a user is logged in. At the moment, I'm using the following code: # Helper function: def get_user(request): try: user = users.ge

Re: big drop-down lists, raw_id_admin and custom primary key: a bug?

2005-10-04 Thread Jason Huggins
Adrian Holovaty wrote: > Oooh, that's a good idea. Django already displays the __repr__() of > the corresponding record on the *change* page, but it'd be nice to do > it automatically (via Ajax) right after the field is populated on the > add page (or changed on the change page). Yup... I notice