-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #419 from ReYaNOW/code_refactoring_in_views
Разнес вюхи по отдельным пакетам, вынес одинаковый код в миксин
- Loading branch information
Showing
25 changed files
with
98 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ributors/views/contributors_for_period.py → ...ributors_views/contributors_for_period.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from django.views import generic | ||
|
||
from contributors.models import Contributor | ||
from contributors.views.mixins import ( | ||
LeaderboardQueryMixin, | ||
TableSortSearchAndPaginationMixin, | ||
) | ||
|
||
|
||
class LeaderboardGenericListView( | ||
LeaderboardQueryMixin, | ||
TableSortSearchAndPaginationMixin, | ||
generic.ListView, | ||
): | ||
"""Generic view for inheritance.""" | ||
|
||
queryset = Contributor.objects.visible().with_contributions() | ||
|
||
searchable_fields = ('login', 'name') | ||
paginate_by = 100 | ||
|
||
|
||
class CommitsListView(LeaderboardGenericListView): | ||
"""List of leaders among contributors by commits.""" | ||
|
||
template_name = ( | ||
'contributors_sections/leaderboard/leaderboard_commits.html' | ||
) | ||
sortable_fields = ( | ||
'-commits', | ||
'login', | ||
'name', | ||
) | ||
ordering = sortable_fields[0] | ||
|
||
|
||
class IssuesListView(LeaderboardGenericListView): | ||
"""List of leaders among contributors by issues.""" | ||
|
||
template_name = 'contributors_sections/leaderboard/leaderboard_issues.html' | ||
sortable_fields = ( | ||
'-issues', | ||
'login', | ||
'name', | ||
) | ||
ordering = sortable_fields[0] | ||
|
||
|
||
class PrsListView(LeaderboardGenericListView): | ||
"""List of leaders among contributors by pull requests.""" | ||
|
||
template_name = 'contributors_sections/leaderboard/leaderboard_prs.html' | ||
sortable_fields = ( | ||
'-pull_requests', | ||
'login', | ||
'name', | ||
) | ||
ordering = sortable_fields[0] |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
contributors/views/repository.py → ...rs/views/repositories_views/repository.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters