-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/Studio-Yandex-Practicum/adap…
…tive_hockey_federation into feature/add_pytest
- Loading branch information
Showing
5 changed files
with
422 additions
and
498 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,186 +1,174 @@ | ||
from django.contrib import admin | ||
from main.models import ( | ||
City, | ||
Competition, | ||
Diagnosis, | ||
Discipline, | ||
Gender, | ||
DisciplineLevel, | ||
DisciplineName, | ||
Document, | ||
Nosology, | ||
Player, | ||
PlayerTeam, | ||
Position, | ||
Qualification, | ||
StaffMember, | ||
StaffTeamMember, | ||
Team, | ||
TeamCompetition, | ||
Trainer, | ||
TrainerTeam, | ||
) | ||
|
||
|
||
class PlayerInline(admin.TabularInline): | ||
model = PlayerTeam | ||
|
||
|
||
class TrainerInline(admin.TabularInline): | ||
model = TrainerTeam | ||
|
||
|
||
class CityAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'name' | ||
) | ||
search_fields = ('name',) | ||
ordering = ['name'] | ||
|
||
|
||
class GenderAdmin(admin.ModelAdmin): | ||
class NosologyAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'name' | ||
) | ||
search_fields = ('name',) | ||
ordering = ['name'] | ||
|
||
|
||
class DisciplineAdmin(admin.ModelAdmin): | ||
class DiagnosisAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'name' | ||
'name', | ||
'nosology' | ||
) | ||
search_fields = ('name',) | ||
search_fields = ( | ||
'pk', 'name', 'nosology',) | ||
ordering = ['name'] | ||
|
||
|
||
class PositionAdmin(admin.ModelAdmin): | ||
class DisciplineNameAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'name' | ||
) | ||
search_fields = ('name',) | ||
ordering = ['name'] | ||
|
||
|
||
class QualificationAdmin(admin.ModelAdmin): | ||
class DisciplineLevelAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'name' | ||
) | ||
search_fields = ('name',) | ||
ordering = ['name'] | ||
|
||
|
||
class TrainerTeamAdmin(admin.ModelAdmin): | ||
class DisciplineAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'trainer', | ||
'team', | ||
'pk', | ||
'discipline_name', | ||
'discipline_level' | ||
) | ||
search_fields = ('trainer', 'team',) | ||
search_fields = ('discipline_name', 'discipline_level',) | ||
ordering = ['discipline_name'] | ||
|
||
|
||
class TrainerAdmin(admin.ModelAdmin): | ||
class DocumentAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'surname', | ||
'name', | ||
'patronymic', | ||
'description', | ||
'file' | ||
) | ||
search_fields = ('pk', 'surname', 'name', 'patronymic', 'description',) | ||
search_fields = ('name', 'file',) | ||
ordering = ['name'] | ||
|
||
|
||
class PlayerAdmin(admin.ModelAdmin): | ||
class StaffMemberAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'surname', | ||
'name', | ||
'patronymic', | ||
'date_of_birth', | ||
'diagnosis', | ||
'gender', | ||
'identification_card', | ||
) | ||
search_fields = ( | ||
'pk', | ||
'surname', | ||
'name', | ||
'patronymic', | ||
'date_of_birth', | ||
'diagnosis', | ||
'gender', | ||
'identification_card', | ||
'phone' | ||
) | ||
search_fields = ('pk', 'surname', 'name', 'patronymic', 'phone',) | ||
|
||
|
||
class DiagnosisAdmin(admin.ModelAdmin): | ||
class StaffTeamMemberAdmin(StaffMemberAdmin): | ||
list_display = ( | ||
'pk', | ||
'class_name', | ||
'is_wheeled', | ||
'description', | ||
'staff_member', | ||
'staff_position', | ||
'qualification', | ||
'notes' | ||
) | ||
search_fields = ( | ||
'pk', 'class_name', 'description',) | ||
'pk', | ||
'staff_member', | ||
'staff_position', | ||
'qualification', | ||
'notes' | ||
) | ||
|
||
|
||
class PlayerTeamAdmin(admin.ModelAdmin): | ||
class PlayerAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'player', | ||
'team', | ||
'qualification', | ||
'surname', | ||
'name', | ||
'patronymic', | ||
'birthday', | ||
'gender', | ||
'diagnosis', | ||
'discipline', | ||
'level_revision', | ||
'position', | ||
'number', | ||
'is_captain', | ||
'is_assistent', | ||
'identity_document', | ||
) | ||
search_fields = ( | ||
'pk', 'player', 'team', 'qualification',) | ||
|
||
|
||
class CompetitionAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'city', | ||
'surname', | ||
'name', | ||
'patronymic', | ||
'birthday', | ||
'gender', | ||
'diagnosis', | ||
'discipline', | ||
'level_revision', | ||
'position', | ||
'number', | ||
'date', | ||
'duration', | ||
'is_active', | ||
'identity_document', | ||
) | ||
search_fields = ( | ||
'pk', 'city', 'number', 'duration',) | ||
list_filter = ('date',) | ||
ordering = ['surname', 'name', 'patronymic', 'birthday'] | ||
|
||
|
||
class TeamCompetitionAdmin(admin.ModelAdmin): | ||
class TeamAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'team', | ||
'competition', | ||
'name', | ||
'city', | ||
'staff_team_member', | ||
'discipline_name' | ||
) | ||
search_fields = ( | ||
'pk', 'team', 'competition',) | ||
|
||
|
||
@admin.register(Team) | ||
class TeamAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'pk', | ||
'name', | ||
'city', | ||
'discipline', | ||
'composition', | ||
'age', | ||
'pk', | ||
'staff_team_member', | ||
'discipline_name' | ||
) | ||
search_fields = [ | ||
'pk', 'name', 'city', 'discipline', 'composition', 'age'] | ||
autocomplete_fields = ['city', 'discipline'] | ||
inlines = [PlayerInline, TrainerInline] | ||
ordering = ['name'] | ||
|
||
|
||
admin.site.register(City, CityAdmin) | ||
admin.site.register(Diagnosis, DiagnosisAdmin) | ||
admin.site.register(Discipline, DisciplineAdmin) | ||
admin.site.register(Gender, GenderAdmin) | ||
admin.site.register(City, CityAdmin) | ||
admin.site.register(DisciplineLevel, DisciplineLevelAdmin) | ||
admin.site.register(DisciplineName, DisciplineNameAdmin) | ||
admin.site.register(Document, DocumentAdmin) | ||
admin.site.register(Nosology, NosologyAdmin) | ||
admin.site.register(Player, PlayerAdmin) | ||
admin.site.register(Position, PositionAdmin) | ||
# admin.site.register(Team, TeamAdmin) | ||
admin.site.register(Qualification, QualificationAdmin) | ||
admin.site.register(PlayerTeam, PlayerTeamAdmin) | ||
admin.site.register(Trainer, TrainerAdmin) | ||
admin.site.register(TrainerTeam, TrainerTeamAdmin) | ||
admin.site.register(Competition, CompetitionAdmin) | ||
admin.site.register(TeamCompetition, TeamCompetitionAdmin) | ||
admin.site.register(StaffTeamMember, StaffTeamMemberAdmin) | ||
admin.site.register(StaffMember, StaffMemberAdmin) | ||
admin.site.register(Team, TeamAdmin) |
Oops, something went wrong.