-
Notifications
You must be signed in to change notification settings - Fork 779
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 Hosts app #150
Conversation
|
||
|
||
@admin.register(ChallengeHostTeam) | ||
class HostTeamModelAdmin(TimeStampedAdmin): |
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.
class name should be ChallengeHostTeamAdmin. convention ideally is name of model + 'Admin'
# Register your models here. | ||
from base.admin import TimeStampedAdmin | ||
|
||
from .models import ChallengeHostTeam, ChallengeHost |
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.
lets write clean code. keep model imports alphabetically. also use tuple like
from .models import (ChallengeHost,
ChallengeHostTeam,)
|
||
|
||
@admin.register(ChallengeHost) | ||
class HostModelAdmin(TimeStampedAdmin): |
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.
update class name here also.
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.
@gauthamzz Can you replace the class name with ChallengeHostAdmin
?
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.
sorry i didnt see this 👎 one minute
@gauthamzz : you need to properly rebase your branch from master. Let me know if you face any issue |
@trojan i hope its okay now ? |
# Register your models here. | ||
from base.admin import TimeStampedAdmin | ||
|
||
from .models import (ChallengeHostAdmin, |
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.
wrong import. model name concerned here are ChallengeHostTeam
and ChallengeHost
|
||
|
||
@admin.register(ChallengeHostTeamAdmin) | ||
class HostTeamModelAdmin(TimeStampedAdmin): |
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.
can you please rename this class to ChallengeHostTeamAdmin
@admin.register(ChallengeHostTeamAdmin) | ||
class HostTeamModelAdmin(TimeStampedAdmin): | ||
list_display = ("team_name", "created_by") | ||
list_filter = ("team_name", "created_by") |
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.
can you please remove team_name
from list_filter
|
||
|
||
@admin.register(ChallengeHostAdmin) | ||
class HostModelAdmin(TimeStampedAdmin): |
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.
please rename this class to ChallengeHostAdmin
|
||
@admin.register(ChallengeHostAdmin) | ||
class HostModelAdmin(TimeStampedAdmin): | ||
list_display = ("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.
permissions can be added in list_display
@admin.register(ChallengeHostAdmin) | ||
class HostModelAdmin(TimeStampedAdmin): | ||
list_display = ("user", "team_name", "status") | ||
list_filter = ("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.
lets give search by user
and team_name
and filter by status
and permissios
. can you please do these changes?
@trojan please review |
@gauthamzz thanks, will review it in night |
@gauthamzz Let me know if you are working on it. We would like to get it done soon. |
@gauthamzz Please check the comments above. There are some changes that need to be done so that we can merge it into master. |
|
||
|
||
@admin.register(ChallengeHostTeam) | ||
class HostTeamModelAdmin(TimeStampedAdmin): |
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.
My bad. I forgot to comment here. Can you please replace HostTeamModelAdmin
with ChallengeHostTeamModelAdmin
?
Lets keep the name consistent throughout the codebase. :-)
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.
done 👍
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.
@deshraj is it okay now ?
@deshraj sorry it took so long |
@gauthamzz No worries. Glad we merged it into master. :-) |
can you review #149 also |
Sure. |
No description provided.