Changes between Version 1 and Version 2 of Ticket #28999, comment 2


Ignore:
Timestamp:
Jan 8, 2018, 3:34:48 PM (6 years ago)
Author:
Andrew Standley

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28999, comment 2

    v1 v2  
    33Hmm, I'm not sure how to best describe my preference. It's part of a larger experimentation with the framework.
    44
    5 I'm trying to experiment with using {{{get_absolute_url}}} on my models, and I have CBV DetailView classes for my models. Firstly it seems round-about to use a URL name that represents a url->view mapping when I know the view I want. The View Class for a given Model is a core relationship that should never change, if someone uses my Models they should want to use my Views for those model. The URL name "should" not change, but it is perfectly reasonable someone may want to use my models and my views without using my urlconf. The url schema (an thus URL name) could be considered a separate matter to the models/views so I would like to de-couple these things in code for my Models/Views.
     5I'm trying to experiment with using {{{get_absolute_url}}} on my models, and I have CBV DetailView classes for my models. Firstly it seems round-about to use a URL name that represents a url->view mapping when I know the view I want. The View Class for a given Model is a core relationship that should never change, if someone uses my Models they should want to use my Views for those model. The URL name "should" not change, but it is perfectly reasonable someone may want to use my models and my views without using my urlconf. The url schema (and thus URL name) could be considered a separate matter to the models/views so I would like to de-couple these things in the code for my Models/Views.
    66
    77I hope that makes sense?
    88
    9 Secondly I would ideally like to find a way to create a 'reverse' that find the url regardless of the namespacing. (So a user of my app would not have to update my models.py if they wanted to include my urlconf under a namespace). Obviously this won't work with URL names, but since every function should have a unique hash, I believe I can make it work using view functions... But that is currently impossible for CBV because of this issue.
     9Secondly I would ideally like to find a way to create a 'reverse' method that finds the url regardless of the namespacing. (So a user of my app would not have to update my models.py if they wanted to include my urlconf under a namespace). Obviously this won't work with URL names, but since every function should have a unique hash, I believe I can make it work using view functions... But that is currently impossible for CBV because of this issue.
    1010
    1111I'm probably trying to be far to fancy for my own good here, but that is the reason for my preference.
Back to Top