-
Notifications
You must be signed in to change notification settings - Fork 786
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
Changes from all commits
b1bf2fb
76e303c
56ab94c
117549d
b735e2b
49cd229
d163265
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,52 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
|
||
from .models import Challenge, Phase | ||
from base.admin import TimeStampedAdmin | ||
|
||
|
||
@admin.register(Challenge) | ||
class ChallengeModelAdmin(TimeStampedAdmin): | ||
list_display = ("title", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be in a line. we have limit for 120 characters. also not all the attributes are required. I will prefer title, start_date, end_date, creator, published, enable_forum, anonymous_leaderboard |
||
"description", | ||
"terms_and_conditions", | ||
"submission_guidelines", | ||
"evaluation_details", | ||
"image", | ||
"start_date", | ||
"end_date", | ||
"creator", | ||
"published", | ||
"enable_forum", | ||
"anonymous_leaderboard") | ||
list_filter = ("title", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. list_filter is generally for a thing where some foreign key is there or some field having limited set of values. title, description, terms_and_condition, submission_guidelines, evaluation_details, image will be generally unique for each challenge. |
||
"description", | ||
"terms_and_conditions", | ||
"submission_guidelines", | ||
"evaluation_details", | ||
"image", | ||
"start_date", | ||
"end_date", | ||
"creator", | ||
"published", | ||
"enable_forum", | ||
"anonymous_leaderboard") | ||
search_fields = ("title", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. search on title and creator will do as of now. |
||
"description", | ||
"terms_and_conditions", | ||
"submission_guidelines", | ||
"evaluation_details", | ||
"image", | ||
"start_date", | ||
"end_date", | ||
"creator", | ||
"published", | ||
"enable_forum", | ||
"anonymous_leaderboard") | ||
|
||
|
||
@admin.register(Phase) | ||
class PhaseModelAdmin(TimeStampedAdmin): | ||
list_display = ("name", "description", "leaderboard_public", "challenge") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove description. reason : it is a text field hence width of row will be larger and a slight inconvenience when looking at the dataset. |
||
list_filter = ("name", "description", "leaderboard_public", "challenge") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leaderboard_public and challenge makes sense here |
||
search_fields = ("name", "description", "leaderboard_public", "challenge") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. by name makes sense |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be in a new PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ill delete this PR and make two separate ones There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
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") | ||
|
||
|
||
@admin.register(ChallengeHost) | ||
class HostModelAdmin(TimeStampedAdmin): | ||
list_display = ("user", "team_name", "status") | ||
list_filter = ("user", "team_name", "status") | ||
search_fields = ("user", "team_name", "status") |
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.
add a new line here in between imports. logically group import statements.
Also
base.admin
should be before.models
import