Commit 1860f06e authored by stef's avatar stef

[enh] only items verified or confirmed in ods

parent 496d707d
...@@ -5,6 +5,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = "nnmon.settings" ...@@ -5,6 +5,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = "nnmon.settings"
from django.conf import settings from django.conf import settings
from bt.models import Violation from bt.models import Violation
from django.db.models import Count
import ooolib import ooolib
from django.utils.html import strip_tags from django.utils.html import strip_tags
import re, htmlentitydefs import re, htmlentitydefs
...@@ -63,17 +64,18 @@ def save_ods(): ...@@ -63,17 +64,18 @@ def save_ods():
doc.set_cell_property('bold', False) doc.set_cell_property('bold', False)
row=3 row=3
for v in Violation.objects.filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']): for v in Violation.objects.filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']).annotate(total=Count('confirmation')):
doc.set_row_property(row, 'height', '16.5pt') if v.total>0 or v.state=='verified':
doc.set_cell_property('wrap-option', 'wrap') doc.set_row_property(row, 'height', '16.5pt')
doc.set_cell_value(1, row, "string", v.country) doc.set_cell_property('wrap-option', 'wrap')
doc.set_cell_value(2, row, "string", v.operator) doc.set_cell_value(1, row, "string", v.country)
doc.set_cell_value(3, row, "string", "%s %s" % (v.type, v.resource_name)) doc.set_cell_value(2, row, "string", v.operator)
doc.set_cell_value(5, row, "string", "%s\n\n%s" % ( v.editorial, unescape(v.comment_set.get().comment))) doc.set_cell_value(3, row, "string", "%s %s" % (v.type, v.resource_name))
doc.set_cell_value(9, row, "string", "%s %s" % ("Contractual" if v.contractual else "", unescape(v.contract_excerpt))) doc.set_cell_value(5, row, "string", "%s\n\n%s" % ( v.editorial, unescape(v.comment_set.get().comment)))
doc.set_cell_value(10, row, "string", "can update to a different dataplan" if v.loophole else "") doc.set_cell_value(9, row, "string", "%s %s" % ("Contractual" if v.contractual else "", unescape(v.contract_excerpt)))
row+=1 doc.set_cell_value(10, row, "string", "can update to a different dataplan" if v.loophole else "")
#(v.state, v.country, v.operator, v.contract, v.resource, v.resource_name, v.type, v.media, v.temporary, v.contractual, v.contract_excerpt, v.loophole, v.editorial,v.comment_set.get().comment) row+=1
#(v.state, v.country, v.operator, v.contract, v.resource, v.resource_name, v.type, v.media, v.temporary, v.contractual, v.contract_excerpt, v.loophole, v.editorial,v.comment_set.get().comment)
# Save the document to the file you want to create # Save the document to the file you want to create
doc.save("/tmp/ec_berec_tm_questionnaire.ods") doc.save("/tmp/ec_berec_tm_questionnaire.ods")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment