Hi,

While trying to get a grip on this [1]ticket about problems experienced
when using the 'otherapp.model' notation to the target model of a
Foreign Key when that model is located on another application. I went to
the relevant [2]docs:

"""
If you need to create a relationship on a model that has not yet been
defined, you can use the name of the model, rather than the model object
itself::

    class Car(models.Model):
        manufacturer = models.ForeignKey('Manufacturer')
        # ...

    class Manufacturer(models.Model):
        # ...

Note, however, that this only refers to models in the same models.py
file -- you cannot use a string to reference a model defined in another
application or imported from elsewhere.

Changed in Django 1.0: Refering models in other applications must
include the application label.

To refer to models defined in another application, you must instead
explicitly specify the application label. For example, if the
Manufacturer model above is defined in another application called
production, you'd need to use...
""""

It seems the two last paragraphs (from "Changed in Django 1.0"
onwards) contradict the paragraph inmediately above them.

Supporting this usage might mean we need to insert at least one
additional django.deb.models.get_apps() call (some of the places where
it has already been inserted so far have associated comments describing
doing that as a hack.)

Namely, from the cases reported in the ticket and associated threads it
seems it would need to be inserted in

django.core.urlresolvers._get_urlconf_module()

But if we don't need to support it we just can change this ticket
component to Documentation and correct the docs to delete the two last
paragraphs.

Am I missing something here?.

Regards,

-- 
Ramiro Morales
http://rmorales.net

1. http://code.djangoproject.com/ticket/10405
2. 
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey

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