On Thu, Sep 9, 2010 at 4:02 PM, Alex Gaynor <alex.gay...@gmail.com> wrote:
>>> INSTALLED_APPS = (
>>>        'django.contrib.auth',
>>>        'django.contrib.contenttypes',
>>>        'django.contrib.sessions',
>>>        'django.contrib.sites',
>>>        'django.contrib.admin',
>>>        ('debug_toolbar', {
>>>                'INTERCEPT_REDIRECTS': False,
>>>                'INTERNAL_IPS': ('127.0.0.2',),
>>>        }),
>>>        'django_extensions',
>>>        ('favorites', {
>>>                'fave': ‘pages.models.Page',
>>>        }),
>>>        'comercial',
>>>        'specs',
>>> )
>>>
>>>
>>> and in favorites.models.py:
>>>
>>>  class Favorite(models.Model):
>>>      item = LazyForeignKey(args[‘fave’])
>>>      user = ForeignKey(User)
>>>      date = DateTimeField(default=utcnow)
>>>
>
> So how does this work?  Where do args come from?

args (for lack of a better name) is the same dictionary passed as the
second part of the tuple in the INSTALLED_APPS list.

when Django loads each app, if the entry in INSTALLED_APPS is a tuple,
the first member is the app name, and the second one is made available
to the app as 'args'.


((erratum: in this case, we don't need any 'LazyForeignKey', the usual
'ForeignKey' works:

  class Favorite(models.Model):
      item = ForeignKey(args[‘fave’])
      user = ForeignKey(User)
      date = DateTimeField(default=utcnow)

))


-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to