-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
Fixed #35682 -- Made Docstring updates in BaseDetailView and BaseList… #18493
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thank you for your contribution 💪
As it's your first contribution be sure to check out the patch review checklist.
If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
@felixxm hey there, i am a new contributor here and this is my first PR, i wanted to ask why the two test cases are failing here. The two are Linters flake8 and black. |
Hello @YashRaj1506! |
Thank you i got it now. |
Co-authored-by: Bhuvnesh <[email protected]>
Co-authored-by: Bhuvnesh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness' sake, I suggest you go through the BaseViews in dates.py as well.
By the way, if a docstring already mentions that a BaseView is an abstract base class, it is reduntant to mention that it requires subclassing. In those cases I suggest: Requires a response mixin.
Yeah i missed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording should probably be consistent across the three cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You left out many other Base Views in dates.py that neglect to mention their subclassing requirements in docstrings.
oh my bad will go work over it, Will read the whole dates.py |
Just to clarify, You mean to say the three places i made changes at, should have the same "this class is meant to be subclassed" message? As i added the response Mixin message in the third dates.py base class? |
For the docstrings which don't mention they are a abstract class like |
I think it's better if we use consistent wording for all Base Views with unclear docstrings. Like so: class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView):
"""
Base view for displaying a list of objects published in a given month.
Requires a response mixin.
""" Let me know what you think. |
The edit that i made on the docstring (yet to commit) looks like this only, I think this would be good enough to go with. I will make the following changes and will tag you if i find something better. |
As it was mentioned in suggestions, that the wording should be same everywhere for the base views, i made the changes accordingly.
fixed flake8 at line 654.
@carltongibson @cliff688 I have made the changes accordingly, keeping both of your suggestions in mind. Will this commit be enough or do i need to make any other changes? Do let me know i will work on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Using this base class requires subclassing to provide a response mixin.
is wordier than Requires a response mixin.
What do you think.
@@ -625,8 651,10 @@ class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView | |||
|
|||
class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView): | |||
""" | |||
Detail view of a single object on a single date; this differs from the | |||
standard DetailView by accepting a year/month/day in the URL. | |||
A base view for Detail view of a single object on a single date; this differs from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A base view for Detail view of a single object on a single date; this differs from | |
A base detail view for a single object on a single date; this differs from | |
the standard DetailView by accepting year/month/day in the URL. |
@@ -300,7 300,11 @@ def _make_single_date_lookup(self, date): | |||
|
|||
|
|||
class BaseDateListView(MultipleObjectMixin, DateMixin, View): | |||
"""Abstract base class for date-based views displaying a list of objects.""" | |||
""" | |||
A base view for date-based views displaying a list of objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous line was probably clearer and more concise:
A base view for date-based views displaying a list of objects. | |
Abstract base class for date-based views displaying a list of objects. |
or maybe
A base view for date-based views displaying a list of objects. | |
Base class for date-based views displaying a list of objects. |
It was but as earlier @carltongibson quoted that all the base views should have a consistency in the wordings, i considered that and made the changes. I will make the minor sentence changes you recommended as those are important. Rest what do you think , Should we turn it back? eitherways it gives a more concrete message. |
Indeed... I also agree that the wording should be consistent💯. Even so, there is still the question of which wording is better🤔. And this is what I meant for us to discuss... |
…View.
Trac ticket number
ticket-35682
Branch description
Majority of the BaseView's like BaseUpdateView, BaseCreateView and other's has specified in their docstring and their docs that
"Using this base class requires subclassing to provide a response mixin." but in BaseListView and BaseDetailView where it is needed to , it is not mentioned inside the docstring but it is mentioned in their docs. So i added the same statement "Using this base class requires subclassing to provide a response mixin." inside the docstring of both BaseListView and BaseDetailView.
Checklist
main
branch.