-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple url_base and view_name #67
Comments
Hi 👋 I'm not sure what you're proposing? (Likely answer is no 🙂)
It does. That's the default value for |
What I'm trying to say is I don't think class DatasetCRUDView(CRUDView):
model = Dataset
url_base = "my-base-url-to-show-datasets" # a little absurd, I know :) produces urls that look like this:
Great, that's exactly what I expect. However, if I want to reverse these urls in python code or templates outside of my CRUDView, I MUST refer to them by the url = reverse("my-base-url-to-show-datasets-list") I think this gets a bit unwieldy over time and could confuse the hell out of new developers to a codebase. If the path name was not coupled so strongly to Hopefully, that's more clear 🤞 |
OK, makes sense. It's not API that I'd add an option for explicitly, but custom Thanks for the follow up! |
Custom Roles sounds like a great feature 👍 I'll keep an eye out for it. Thanks for the package btw! Helped me streamline a lot of code from multiple projects. |
Glad you're enjoying it, and thanks again for the feedback 😊 |
At the moment,
CRUDView.url_base
is strongly coupled with the path name for a given role (seeRole.get_url
) which I don't think makes a lot of sense.IMO, the base component of the path name should always default to
cls.model._meta.model_name
and MAYBE have a separate option at the class level to change it, e.g.CRUDView.path_name_base
or whatever.On another note, why provide the
url_base
option at all? This functionality can already be handled inurls.py
using the include function.IMO (again), the above is a much simpler and easy-to-understand way to declare this as opposed to a class-based option.
The text was updated successfully, but these errors were encountered: