SHOW:
|
|
- or go back to the newest paste.
| 1 | ||
| 2 | - | Error |
| 2 | + | |
| 3 | - | Django Version: 1.6 |
| 3 | + | |
| 4 | - | Exception Type: TypeError |
| 4 | + | |
| 5 | - | Exception Value: |
| 5 | + | |
| 6 | - | cannot concatenate 'str' and 'QuerySet' objects |
| 6 | + | |
| 7 | ||
| 8 | class Meta: | |
| 9 | verbose_name_plural="services" | |
| 10 | ||
| 11 | def __unicode__(self): | |
| 12 | return self.service_name | |
| 13 | ||
| 14 | #views.py | |
| 15 | ||
| 16 | def get_box_services(request): | |
| 17 | box_id = request.GET.get("box_id", "")
| |
| 18 | box_services = Service.objects.filter(box_id=box_id) | |
| 19 | render_to_response("box_services.html",
| |
| 20 | {"box_services":box_services})
| |
| 21 | ||
| 22 | ||
| 23 | #template | |
| 24 | <table border="0" cellspacing="5" cellpadding="5"> | |
| 25 | <tr> | |
| 26 | <th>Service Name</th><th>Port</th><th>Status</th><th>Options</th> | |
| 27 | </tr> | |
| 28 | {% for box_service in box_services %}
| |
| 29 | <tr> | |
| 30 | <td>{{box_service.service_name}}</td>
| |
| 31 | <td>{{box_service.service_port}}</td>
| |
| 32 | - | <th>Service Name</th><th>Port</th><th>Options</th> |
| 32 | + | <td>{{box_service.service_status}}</td>
|
| 33 | ||
| 34 | {% ifequal box_service.service_status "service_up" %}
| |
| 35 | <td>Stop|Restart</td> | |
| 36 | {% else %}
| |
| 37 | <td>Start</td> | |
| 38 | - | <td>Start|Stop|Restart</td> |
| 38 | + | { % endifequal %}
|
| 39 | ||
| 40 | </tr> | |
| 41 | {% endfor %}
| |
| 42 | </table> | |
| 43 | ||
| 44 | - | New traceback |
| 44 | + | |
| 45 | """ | |
| 46 | Environment: | |
| 47 | ||
| 48 | ||
| 49 | Request Method: GET | |
| 50 | - | Request URL: http://127.0.0.1:8000/get_box_services/?box_id=1 |
| 50 | + | Request URL: http://127.0.0.1:8000/box_services/?box_id=1&ip=127.0.0.1 |
| 51 | ||
| 52 | Django Version: 1.6 | |
| 53 | Python Version: 2.7.3 | |
| 54 | Installed Applications: | |
| 55 | ('django.contrib.admin',
| |
| 56 | 'django.contrib.auth', | |
| 57 | 'django.contrib.contenttypes', | |
| 58 | 'django.contrib.sessions', | |
| 59 | 'django.contrib.messages', | |
| 60 | 'django.contrib.staticfiles', | |
| 61 | 'sysradar', | |
| 62 | 'monitor') | |
| 63 | Installed Middleware: | |
| 64 | ('django.contrib.sessions.middleware.SessionMiddleware',
| |
| 65 | 'django.middleware.common.CommonMiddleware', | |
| 66 | 'django.middleware.csrf.CsrfViewMiddleware', | |
| 67 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
| 68 | 'django.contrib.messages.middleware.MessageMiddleware', | |
| 69 | 'django.middleware.clickjacking.XFrameOptionsMiddleware') | |
| 70 | ||
| 71 | ||
| 72 | Template error: | |
| 73 | - | In template /home/oquidave/workspace/python/sysradar/monitor/templates/box_services.html, error at line 13 |
| 73 | + | In template /home/oquidave/workspace/python/sysradar/monitor/templates/box_services_status.html, error at line 26 |
| 74 | - | 'Service' object is not iterable |
| 74 | + | Invalid block tag: 'endfor', expected 'endifequal' |
| 75 | - | 3 : <head> |
| 75 | + | |
| 76 | ||
| 77 | ||
| 78 | - | 4 : <meta charset="UTF-8"> |
| 78 | + | 17 : <td>{{box_service.service_status}}</td>
|
| 79 | ||
| 80 | ||
| 81 | - | 5 : <title>Insert title here</title> |
| 81 | + | 18 : |
| 82 | ||
| 83 | ||
| 84 | - | 6 : </head> |
| 84 | + | 19 : {% ifequal box_service.service_status "service_up" %}
|
| 85 | ||
| 86 | ||
| 87 | - | 7 : <body> |
| 87 | + | 20 : <td>Stop|Restart</td> |
| 88 | ||
| 89 | ||
| 90 | - | 8 : |
| 90 | + | 21 : {% else %}
|
| 91 | ||
| 92 | ||
| 93 | - | 9 : <table border="0" cellspacing="5" cellpadding="5"> |
| 93 | + | 22 : <td>Start</td> |
| 94 | ||
| 95 | ||
| 96 | - | 10 : <tr> |
| 96 | + | 23 : { % endifequal %}
|
| 97 | ||
| 98 | ||
| 99 | - | 11 : <th>Service Name</th><th>Port</th><th>Options</th> |
| 99 | + | 24 : |
| 100 | ||
| 101 | ||
| 102 | - | 12 : </tr> |
| 102 | + | 25 : </tr> |
| 103 | ||
| 104 | ||
| 105 | - | 13 : {% for box_service in box_services %}
|
| 105 | + | 26 : {% endfor %}
|
| 106 | ||
| 107 | ||
| 108 | - | 14 : <tr> |
| 108 | + | 27 : </table> |
| 109 | ||
| 110 | ||
| 111 | - | 15 : <td>{{box_service.service_name}}</td>
|
| 111 | + | 28 : |
| 112 | ||
| 113 | ||
| 114 | 29 : </body> | |
| 115 | ||
| 116 | ||
| 117 | - | 17 : <td>Start|Stop|Restart</td> |
| 117 | + | 30 : </html> |
| 118 | ||
| 119 | Traceback: | |
| 120 | - | 18 : </tr> |
| 120 | + | |
| 121 | 114. response = wrapped_callback(request, *callback_args, **callback_kwargs) | |
| 122 | File "/home/oquidave/workspace/python/sysradar/monitor/views.py" in check_box_services | |
| 123 | - | 19 : {% endfor %}
|
| 123 | + | 118. {"box_services":services})
|
| 124 | File "/usr/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response | |
| 125 | 29. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) | |
| 126 | - | 20 : </table> |
| 126 | + | |
| 127 | 162. t = get_template(template_name) | |
| 128 | File "/usr/lib/python2.7/site-packages/django/template/loader.py" in get_template | |
| 129 | - | 21 : |
| 129 | + | 138. template, origin = find_template(template_name) |
| 130 | File "/usr/lib/python2.7/site-packages/django/template/loader.py" in find_template | |
| 131 | 127. source, display_name = loader(name, dirs) | |
| 132 | - | 22 : </body> |
| 132 | + | File "/usr/lib/python2.7/site-packages/django/template/loader.py" in __call__ |
| 133 | 43. return self.load_template(template_name, template_dirs) | |
| 134 | File "/usr/lib/python2.7/site-packages/django/template/loader.py" in load_template | |
| 135 | - | 23 : </html> |
| 135 | + | 49. template = get_template_from_string(source, origin, template_name) |
| 136 | File "/usr/lib/python2.7/site-packages/django/template/loader.py" in get_template_from_string | |
| 137 | 149. return Template(source, origin, name) | |
| 138 | File "/usr/lib/python2.7/site-packages/django/template/base.py" in __init__ | |
| 139 | 125. self.nodelist = compile_string(template_string, origin) | |
| 140 | - | File "/home/oquidave/workspace/python/sysradar/monitor/views.py" in get_box_services |
| 140 | + | File "/usr/lib/python2.7/site-packages/django/template/base.py" in compile_string |
| 141 | - | 95. {"box_services":box_services})
|
| 141 | + | 153. return parser.parse() |
| 142 | File "/usr/lib/python2.7/site-packages/django/template/base.py" in parse | |
| 143 | 278. compiled_result = compile_func(self, token) | |
| 144 | File "/usr/lib/python2.7/site-packages/django/template/defaulttags.py" in do_for | |
| 145 | - | 164. return t.render(Context(dictionary)) |
| 145 | + | 806. nodelist_loop = parser.parse(('empty', 'endfor',))
|
| 146 | - | File "/usr/lib/python2.7/site-packages/django/template/base.py" in render |
| 146 | + | File "/usr/lib/python2.7/site-packages/django/template/base.py" in parse |
| 147 | - | 140. return self._render(context) |
| 147 | + | 278. compiled_result = compile_func(self, token) |
| 148 | - | File "/usr/lib/python2.7/site-packages/django/template/base.py" in _render |
| 148 | + | File "/usr/lib/python2.7/site-packages/django/template/defaulttags.py" in ifequal |
| 149 | - | 134. return self.nodelist.render(context) |
| 149 | + | 848. return do_ifequal(parser, token, False) |
| 150 | - | File "/usr/lib/python2.7/site-packages/django/template/base.py" in render |
| 150 | + | File "/usr/lib/python2.7/site-packages/django/template/defaulttags.py" in do_ifequal |
| 151 | - | 840. bit = self.render_node(node, context) |
| 151 | + | 823. nodelist_false = parser.parse((end_tag,)) |
| 152 | - | File "/usr/lib/python2.7/site-packages/django/template/debug.py" in render_node |
| 152 | + | File "/usr/lib/python2.7/site-packages/django/template/base.py" in parse |
| 153 | - | 78. return node.render(context) |
| 153 | + | 276. self.invalid_block_tag(token, command, parse_until) |
| 154 | - | File "/usr/lib/python2.7/site-packages/django/template/defaulttags.py" in render |
| 154 | + | File "/usr/lib/python2.7/site-packages/django/template/base.py" in invalid_block_tag |
| 155 | - | 155. values = list(values) |
| 155 | + | 331. (command, get_text_list(["'%s'" % p for p in parse_until]))) |
| 156 | ||
| 157 | - | Exception Type: TypeError at /get_box_services/ |
| 157 | + | Exception Type: TemplateSyntaxError at /box_services/ |
| 158 | - | Exception Value: 'Service' object is not iterable |
| 158 | + | Exception Value: Invalid block tag: 'endfor', expected 'endifequal' |
| 159 | """ |