Changes between Version 1 and Version 2 of Ticket #28999, comment 2
- Timestamp:
- Jan 8, 2018, 3:34:48 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28999, comment 2
v1 v2 3 3 Hmm, I'm not sure how to best describe my preference. It's part of a larger experimentation with the framework. 4 4 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 incode for my Models/Views.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 (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. 6 6 7 7 I hope that makes sense? 8 8 9 Secondly I would ideally like to find a way to create a 'reverse' that findthe 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.9 Secondly 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. 10 10 11 11 I'm probably trying to be far to fancy for my own good here, but that is the reason for my preference.