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 Hosts app #150

Merged
merged 9 commits into from
Dec 3, 2016
19 changes: 18 additions & 1 deletion apps/hosts/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
from django.contrib import admin

# Register your models here.
from base.admin import TimeStampedAdmin

from .models import (ChallengeHostAdmin,
Copy link
Member

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

ChallengeHostTeamAdmin)


@admin.register(ChallengeHostTeamAdmin)
class HostTeamModelAdmin(TimeStampedAdmin):
Copy link
Member

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'

Copy link
Member

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

Copy link
Member

@deshraj deshraj Dec 3, 2016

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. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done 👍

Copy link
Contributor Author

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 ?

list_display = ("team_name", "created_by")
list_filter = ("team_name", "created_by")
Copy link
Member

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

search_fields = ("team_name", "created_by")


@admin.register(ChallengeHostAdmin)
class HostModelAdmin(TimeStampedAdmin):
Copy link
Member

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.

Copy link
Member

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 ?

Copy link
Contributor Author

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

Copy link
Member

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

list_display = ("user", "team_name", "status")
Copy link
Member

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

list_filter = ("user", "team_name", "status")
Copy link
Member

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?

search_fields = ("user", "team_name", "status")