Skip to content

Commit

Permalink
Make JobReviewComment available in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
berkerpeksag committed Aug 9, 2017
1 parent 7430517 commit 8e44f43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion jobs/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from .models import JobType, JobCategory, Job
from .models import JobType, JobCategory, Job, JobReviewComment
from cms.admin import NameSlugAdmin, ContentManageableModelAdmin


Expand All @@ -10,6 +10,7 @@ class JobAdmin(ContentManageableModelAdmin):
list_display = ['__str__', 'job_title', 'status', 'company_name']
list_filter = ['status', 'telecommuting']
raw_id_fields = ['category']
search_fields = ['id', 'job_title']


class JobTypeAdmin(NameSlugAdmin):
Expand All @@ -25,6 +26,13 @@ class JobCategoryAdmin(NameSlugAdmin):
list_filter = ['active']
ordering = ('-active', 'name')


class JobReviewCommentAdmin(ContentManageableModelAdmin):
list_display = ['__str__', 'job']
ordering = ('-created',)

admin.site.register(JobCategory, JobCategoryAdmin)

admin.site.register(Job, JobAdmin)

admin.site.register(JobReviewComment, JobReviewCommentAdmin)
3 changes: 3 additions & 0 deletions jobs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def save(self, **kwargs):
comment_was_posted.send(sender=self.__class__, comment=self)
return super().save(**kwargs)

def __str__(self):
return '<Job #{}: {}>'.format(self.job.pk, self.comment.raw[:50])


@receiver(post_save, sender=Job)
def purge_fastly_cache(sender, instance, **kwargs):
Expand Down

0 comments on commit 8e44f43

Please sign in to comment.