Skip to content
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

Setup ModelAdmin class for each model in Host and Challenge app #133

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion apps/challenges/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
from django.contrib import admin

# Register your models here.

from .models import Challenge,Phase
from base.admin import TimeStampedAdmin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a new line here in between imports. logically group import statements.

Also base.admin should be before .models import


@admin.register(Challenge)
class ChallengeModelAdmin(TimeStampedAdmin):
list_display = ("title","description","terms_and_conditions","submission_guidelines","evaluation_details","image","start_date","end_date","creator","published","enable_forum","anonymous_leaderboard")
list_filter = ("title","description","terms_and_conditions","submission_guidelines","evaluation_details","image","start_date","end_date","creator","published","enable_forum","anonymous_leaderboard")
search_fields = ("title","description","terms_and_conditions","submission_guidelines","evaluation_details","image","start_date","end_date","creator","published","enable_forum","anonymous_leaderboard")
class Meta:
model = Challenge

@admin.register(Phase)
class PhaseModelAdmin(TimeStampedAdmin):
list_display = ("name","description","leaderboard_public","challenge")
list_filter = ("name","description","leaderboard_public","challenge")
search_fields = ("name","description","leaderboard_public","challenge")
class Meta:
model = Phase
20 changes: 19 additions & 1 deletion apps/hosts/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
from django.contrib import admin

# Register your models here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in a new PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill delete this PR and make two separate ones

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#150 #149 is created instead

from .models import ChallengeHostTeam,ChallengeHost
from base.admin import TimeStampedAdmin

@admin.register(ChallengeHostTeam)
class HostTeamModelAdmin(TimeStampedAdmin):
list_display = ("team_name","created_by")
list_filter = ("team_name","created_by")
search_fields = ("team_name","created_by")
class Meta:
model = ChallengeHostTeam

@admin.register(ChallengeHost)
class HostModelAdmin(TimeStampedAdmin):
list_display = ("user","team_name","status")
list_filter = ("user","team_name","status")
search_fields = ("user","team_name","status")
class Meta:
model = ChallengeHost
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ coveralls==1.1
flake8==3.0.4
pytest-cov==2.4.0
pytest==3.0.3
sphinx==1.4.8
sphinx==1.4.8
sphinx-autobuild==0.6.0
sphinx-rtd-theme==0.1.9