from django import template
from django.core.urlresolvers import reverse

from ..models import TestCycle, TestRun, TestRunIncludedTestCase



register = template.Library()



@register.filter
def results_detail_url(obj):
    if isinstance(obj, TestCycle):
        return reverse("results_testruns") + "?testCycle=%s" % obj.id
    elif isinstance(obj, TestRun):
        return reverse("results_testcases") + "?testRun=%s" % obj.id
    elif isinstance(obj, TestRunIncludedTestCase):
        return reverse("results_testcase_detail", kwargs={"itc_id": obj.id})
    return ""

from django import template
from django.core.urlresolvers import reverse

from ..models import TestCycle, TestRun, TestRunIncludedTestCase



register = template.Library()



@register.filter
def results_detail_url(obj):
    if isinstance(obj, TestCycle):
        return reverse("results_testruns") + "?filter-testCycle=%s" % obj.id
    elif isinstance(obj, TestRun):
        return reverse("results_testcases") + "?filter-testRun=%s" % obj.id
    elif isinstance(obj, TestRunIncludedTestCase):
        return reverse("results_testcase_detail", kwargs={"itc_id": obj.id})
    return ""

Fix result status chiclet links for new-style filter querystrings.
Fix result status chiclet links for new-style filter querystrings.

  from django import template
  from django.core.urlresolvers import reverse
  
  from ..models import TestCycle, TestRun, TestRunIncludedTestCase
  
  
  
  register = template.Library()
  
  
  
  @register.filter
  def results_detail_url(obj):
      if isinstance(obj, TestCycle):
-         return reverse("results_testruns") + "?testCycle=%s" % obj.id
+         return reverse("results_testruns") + "?filter-testCycle=%s" % obj.id
      elif isinstance(obj, TestRun):
-         return reverse("results_testcases") + "?testRun=%s" % obj.id
+         return reverse("results_testcases") + "?filter-testRun=%s" % obj.id
      elif isinstance(obj, TestRunIncludedTestCase):
          return reverse("results_testcase_detail", kwargs={"itc_id": obj.id})
      return ""
  
Fix result status chiclet links for new-style filter querystrings.
## Code Before:
from django import template
from django.core.urlresolvers import reverse

from ..models import TestCycle, TestRun, TestRunIncludedTestCase



register = template.Library()



@register.filter
def results_detail_url(obj):
    if isinstance(obj, TestCycle):
        return reverse("results_testruns") + "?testCycle=%s" % obj.id
    elif isinstance(obj, TestRun):
        return reverse("results_testcases") + "?testRun=%s" % obj.id
    elif isinstance(obj, TestRunIncludedTestCase):
        return reverse("results_testcase_detail", kwargs={"itc_id": obj.id})
    return ""

## Instruction:
Fix result status chiclet links for new-style filter querystrings.
## Code After:
from django import template
from django.core.urlresolvers import reverse

from ..models import TestCycle, TestRun, TestRunIncludedTestCase



register = template.Library()



@register.filter
def results_detail_url(obj):
    if isinstance(obj, TestCycle):
        return reverse("results_testruns") + "?filter-testCycle=%s" % obj.id
    elif isinstance(obj, TestRun):
        return reverse("results_testcases") + "?filter-testRun=%s" % obj.id
    elif isinstance(obj, TestRunIncludedTestCase):
        return reverse("results_testcase_detail", kwargs={"itc_id": obj.id})
    return ""
