Skip to content

Commit

Permalink
Limit text to 500 chars and wrap it to 70 char per line.
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed Feb 4, 2015
1 parent 16b449e commit 9605127
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion snippets/base/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import re
from textwrap import wrap

from django.contrib import admin
from django.db import transaction
Expand Down Expand Up @@ -197,7 +198,8 @@ def text(self, obj):
text_keys = (obj.template.variable_set
.filter(type=models.SnippetTemplateVariable.TEXT)
.values_list('name', flat=True))
return '\n'.join([data[key] for key in text_keys if data.get(key)])

return ' '.join(wrap('\n'.join([data[key][:500] for key in text_keys if data.get(key)])))


class ClientMatchRuleAdmin(BaseModelAdmin):
Expand Down

0 comments on commit 9605127

Please sign in to comment.