Changes between Version 2 and Version 3 of Ticket #3646


Ignore:
Timestamp:
Mar 3, 2007, 12:08:44 PM (18 years ago)
Author:
James Bennett
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3646 – Description

    v2 v3  
    1 The docs for the `ABSOLUTE_URL_OVERRIDES` setting state that the keys in that dictionary should be of the form `app_label.modelname`, with the model name capitalized, but the code in `django/db/models/base.py` which curries `get_absolute_url` looks for `app_label.module_name`, and `module_name` is normalized to lower-case by that point. So, for example, the docs say to use `weblog.Entry` as a key in `ABSOLUTE_URL_OVERRIDES`, but `get_absolute_url` will actually look for `weblog.entry`.
     1The docs for the `ABSOLUTE_URL_OVERRIDES` setting state that the keys in that dictionary should be of the form `app_label.modelname`, with the model name capitalized, but the code in `django/db/models/base.py` which curries `get_absolute_url` looks for `app_label.module_name`, and `module_name` is normalized to lower-case by that point.
     2
     3So, for example, the docs say to use `weblog.Entry` as a key in `ABSOLUTE_URL_OVERRIDES`, but `get_absolute_url` will actually look for `weblog.entry`.
    24
    35I'm of two minds on how to solve this; the naive solution is to have the curried `get_absolute_url` look for `opts.module_name.capitalize()`, since that will make it consistent with the examples in the docs, but it's entirely possible that someone will create a model class with an all-lowercase name (which is, I assume, why `module_name` is normalizing it to lowercase), in which case the better solution is to change the docs.
Back to Top