Skip to content

Commit

Permalink
Merge pull request #33 from rloomans/admin-search-more
Browse files Browse the repository at this point in the history
Search more fields in Admin interface
  • Loading branch information
rloomans committed Sep 26, 2017
2 parents 480f3e0 + b64eb39 commit 207c49d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions teamtemp/responses/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WordCloudImageAdmin(admin.ModelAdmin):
list_display = ("id", "word_hash", "image_url", "creation_date", "modified_date")
list_display_links = ("id", "word_hash", "image_url")
readonly_fields = ("id", "creation_date", "modified_date", "word_list", "word_hash")
search_fields = ("id", "word_hash")
search_fields = ("id", "word_hash", "word_list")

def view_on_site(self, obj):
return obj.image_url
Expand Down Expand Up @@ -58,7 +58,7 @@ class TemperatureResponseAdmin(admin.ModelAdmin):
list_filter = ("archived",)
readonly_fields = ("id",)
raw_id_fields = ("responder", "request")
search_fields = ("team_name", "request__id")
search_fields = ("team_name", "request__id", "word")

def view_on_site(self, obj):
return reverse('bvc', kwargs={'survey_id': obj.request.id, 'team_name': obj.team_name})
Expand Down
4 changes: 2 additions & 2 deletions teamtemp/responses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class TemperatureResponse(models.Model):
request = models.ForeignKey(TeamTemperature, related_name="temperature_responses")
responder = models.ForeignKey(User, related_name="temperature_responses")
score = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)])
word = models.CharField(max_length=32)
word = models.CharField(max_length=32, db_index=True)
team_name = models.CharField(max_length=64, db_index=True)
archived = models.BooleanField(default=False, db_index=True)
response_date = models.DateTimeField(db_index=True)
Expand Down Expand Up @@ -164,7 +164,7 @@ class Meta(object):
average_score = models.DecimalField(decimal_places=5, max_digits=10)
minimum_score = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)], null=True, blank=True)
maximum_score = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)], null=True, blank=True)
word_list = models.CharField(max_length=5000)
word_list = models.CharField(max_length=5000, db_index=True)
responder_count = models.PositiveSmallIntegerField()
team_name = models.CharField(max_length=64, null=True, db_index=True)
archive_date = models.DateTimeField(db_index=True)
Expand Down

0 comments on commit 207c49d

Please sign in to comment.