author | Lennard de Rijk <ljvderijk@gmail.com> |
Mon, 27 Jul 2009 15:03:20 +0200 | |
changeset 2683 | 8ea17736a10d |
parent 2277 | 96082450e62c |
child 2948 | 66fe1a62d4e2 |
permissions | -rw-r--r-- |
38
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
2 |
# |
1308
35b75ffcbb37
Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
38
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
4 |
# |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
8 |
# |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
10 |
# |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
16 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
17 |
"""A Django template tag library containing forms helpers. |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
18 |
""" |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
19 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
21 |
'"Todd Larsen" <tlarsen@google.com>', |
99
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
22 |
'"Pawel Solyga" <pawel.solyga@gmail.com>', |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
23 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
38
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
24 |
] |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
25 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
26 |
|
1371
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
27 |
import re |
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
28 |
|
38
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
29 |
from django import template |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
30 |
from django.forms import forms as forms_in |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
31 |
from django.utils.encoding import force_unicode |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
32 |
from django.utils.html import escape |
316
9efdc7bc3565
Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
273
diff
changeset
|
33 |
|
1977
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
34 |
from soc.logic import accounts |
1371
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
35 |
from soc.logic import dicts |
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
36 |
from soc.views.helper import widgets |
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
37 |
|
322
6641e941ef1e
Fixed imports sorting based on comments for r751.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
316
diff
changeset
|
38 |
|
38
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
39 |
register = template.Library() |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
40 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
41 |
|
1964
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
42 |
@register.inclusion_tag('soc/templatetags/_as_user.html') |
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
43 |
def as_user(user): |
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
44 |
"""Prints a user as a hyperlinked link_id. |
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
45 |
""" |
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
46 |
|
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
47 |
return {'user': user} |
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
48 |
|
96e45d34ee71
Added an as_user template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1820
diff
changeset
|
49 |
|
1977
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
50 |
@register.inclusion_tag('soc/templatetags/_as_email.html') |
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
51 |
def as_email(account): |
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
52 |
"""Prints a user as a hyperlinked link_id. |
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
53 |
""" |
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
54 |
|
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
55 |
denormalized = accounts.denormalizeAccount(account) |
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
56 |
|
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
57 |
return {'email': denormalized.email()} |
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
58 |
|
2dab2aac313d
Added an as_email template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1964
diff
changeset
|
59 |
|
38
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
60 |
@register.inclusion_tag('soc/templatetags/_field_as_table_row.html') |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
61 |
def field_as_table_row(field): |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
62 |
"""Prints a newforms field as a table row. |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
63 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
64 |
This function actually does very little, simply passing the supplied |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
65 |
form field instance in a simple context used by the _field_as_table_row.html |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
66 |
template (which is actually doing all of the work). |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
67 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
68 |
See soc/templates/soc/templatetags/_field_as_table_row.html for the CSS |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
69 |
styles used by this template tag. |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
70 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
71 |
Usage: |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
72 |
{% load forms_helpers %} |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
73 |
... |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
74 |
<table> |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
75 |
{% field_as_table_row form.fieldname %} |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
76 |
... |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
77 |
</table> |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
78 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
79 |
Args: |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
80 |
field: a Django newforms field instance |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
81 |
|
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
82 |
Returns: |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
83 |
a simple context containing the supplied newforms field instance: |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
84 |
{ 'field': field } |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
85 |
""" |
9a6ee3ab1446
A {% field_as_table_row %} template tag to simplify custom forms.
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
86 |
return {'field': field} |
99
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
87 |
|
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
88 |
|
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
89 |
@register.inclusion_tag('soc/templatetags/_readonly_field_as_table_row.html') |
1815
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
90 |
def readonly_field_as_table_row(label, value): |
99
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
91 |
"""Prints a field value and it's verbose name as a table row. |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
92 |
|
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
93 |
This function actually does very little, simply passing the |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
94 |
supplied field_label and field_value in a simple context used by the |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
95 |
_readonly_field_as_table_row.html template (which is actually |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
96 |
doing all of the work). |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
97 |
|
744
cd9bf163473c
Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
741
diff
changeset
|
98 |
See soc/templates/soc/templatetags/_readonly_field_as_table_row.html for |
cd9bf163473c
Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
741
diff
changeset
|
99 |
the CSS styles used by this template tag. |
99
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
100 |
|
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
101 |
Usage: |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
102 |
{% load forms_helpers %} |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
103 |
... |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
104 |
<table> |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
105 |
{% readonly_field_as_table_row field_label field_value %} |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
106 |
... |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
107 |
</table> |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
108 |
|
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
109 |
Args: |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
110 |
field_label: label of the field to render |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
111 |
field_value: value of the field to render |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
112 |
|
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
113 |
Returns: |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
114 |
a simple context containing the supplied newforms field instance: |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
115 |
{ 'field_label': field_label', |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
116 |
'field_value': field_value'} |
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
117 |
""" |
1815
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
118 |
|
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
119 |
value = value.strip() if isinstance(value, basestring) else value |
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
120 |
|
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
121 |
return {'field_label': label, |
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
122 |
'field_value': value} |
99
8c38b546a3cf
Added public view support (not using controller yet)
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
123 |
|
835
1590625ead55
Add missing blank lines and dots in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
794
diff
changeset
|
124 |
|
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
125 |
@register.inclusion_tag( |
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
126 |
'soc/templatetags/_readonly_field_as_twoline_table_row.html') |
1815
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
127 |
def readonly_field_as_twoline_table_row(label, value): |
794
19c24508c398
Added _readonly_field_as_twoline_table_row .
Lennard de Rijk <ljvderijk@gmail.com>
parents:
785
diff
changeset
|
128 |
"""See readonly_field_as_table_row(). |
19c24508c398
Added _readonly_field_as_twoline_table_row .
Lennard de Rijk <ljvderijk@gmail.com>
parents:
785
diff
changeset
|
129 |
""" |
1815
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
130 |
|
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
131 |
value = value.strip() if isinstance(value, basestring) else value |
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
132 |
|
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
133 |
return {'field_label': label, |
7a9b69f36111
Always convert newlines to linebreaks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1714
diff
changeset
|
134 |
'field_value': value} |
794
19c24508c398
Added _readonly_field_as_twoline_table_row .
Lennard de Rijk <ljvderijk@gmail.com>
parents:
785
diff
changeset
|
135 |
|
1586
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
136 |
|
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
137 |
@register.inclusion_tag( |
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
138 |
'soc/templatetags/_readonly_url_field_as_table_row.html') |
1586
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
139 |
def readonly_url_field_as_table_row(field_label, field_value): |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
140 |
"""See readonly_field_as_table_row(). |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
141 |
""" |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
142 |
return {'field_label': field_label, |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
143 |
'field_value': field_value} |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
144 |
|
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
145 |
|
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
146 |
@register.inclusion_tag( |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
147 |
'soc/templatetags/_readonly_url_field_as_twoline_table_row.html') |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
148 |
def readonly_url_field_as_twoline_table_row(field_label, field_value): |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
149 |
"""See readonly_field_as_table_row(). |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
150 |
""" |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
151 |
return {'field_label': field_label, |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
152 |
'field_value': field_value} |
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
153 |
|
8a6caee3c9d6
Add a new template tag _readonly_url_field_as_table_row
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1531
diff
changeset
|
154 |
|
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
155 |
@register.inclusion_tag( |
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
156 |
'soc/templatetags/_readonly_safe_field_as_table_row.html') |
1588
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
157 |
def readonly_safe_field_as_table_row(field_label, field_value): |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
158 |
"""See readonly_field_as_table_row(). |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
159 |
""" |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
160 |
return {'field_label': field_label, |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
161 |
'field_value': field_value} |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
162 |
|
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
163 |
|
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
164 |
@register.inclusion_tag( |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
165 |
'soc/templatetags/_readonly_safe_field_as_twoline_table_row.html') |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
166 |
def readonly_safe_field_as_twoline_table_row(field_label, field_value): |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
167 |
"""See readonly_field_as_table_row(). |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
168 |
""" |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
169 |
return {'field_label': field_label, |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
170 |
'field_value': field_value} |
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
171 |
|
354e685d57fa
Added a _readonly_safe_field_as_table_row template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1586
diff
changeset
|
172 |
|
1341
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
173 |
@register.inclusion_tag('soc/templatetags/_as_readonly_table.html', |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
174 |
takes_context=True) |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
175 |
def as_readonly_table(context, form): |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
176 |
"""Outputs a form as a properly formatted html table. |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
177 |
|
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
178 |
Args: |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
179 |
form: the form that should be converted to a table |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
180 |
""" |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
181 |
|
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
182 |
# create the bound fields |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
183 |
fields = [forms_in.BoundField(form, field, name) for name, field in |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
184 |
form.fields.items() if field] |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
185 |
|
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
186 |
return {'fields': fields} |
1b4b4a9ac17b
Add an as_readonly_table filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
187 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
188 |
@register.inclusion_tag('soc/templatetags/_as_table.html', takes_context=True) |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
189 |
def as_table(context, form): |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
190 |
"""Outputs a form as a properly formatted html table. |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
191 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
192 |
Args: |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
193 |
form: the form that should be converted to a table |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
194 |
""" |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
195 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
196 |
return as_table_helper(context, form) |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
197 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
198 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
199 |
@register.inclusion_tag('soc/templatetags/_as_twoline_table.html', |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
200 |
takes_context=True) |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
201 |
def as_twoline_table(context, form): |
835
1590625ead55
Add missing blank lines and dots in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
794
diff
changeset
|
202 |
"""Outputs a form as a properly formatted html table. |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
203 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
204 |
Args: |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
205 |
form: the form that should be converted to a table |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
206 |
""" |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
207 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
208 |
return as_table_helper(context, form) |
785
c740d0129cce
Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents:
754
diff
changeset
|
209 |
|
835
1590625ead55
Add missing blank lines and dots in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
794
diff
changeset
|
210 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
211 |
def as_table_helper(context, form): |
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
212 |
"""See as_table(). |
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
213 |
""" |
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
214 |
|
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
215 |
fields = [] |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
216 |
hidden_fields = [] |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
217 |
hidden_fields_errors = [] |
1820
ecc40aa58e19
Display a warning if there are errors on the form
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1815
diff
changeset
|
218 |
errors = False |
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
219 |
|
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
220 |
# entity = context['entity'] |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
221 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
222 |
# Iterate over all fields and prepare it for adding |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
223 |
for name, field in form.fields.items(): |
1282
005be2cf889d
Do not attempt to render a field if it is disabled
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1271
diff
changeset
|
224 |
if not field: |
005be2cf889d
Do not attempt to render a field if it is disabled
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1271
diff
changeset
|
225 |
continue |
005be2cf889d
Do not attempt to render a field if it is disabled
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1271
diff
changeset
|
226 |
|
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
227 |
bf = forms_in.BoundField(form, field, name) |
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
228 |
attrs = {} |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
229 |
|
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
230 |
if isinstance(field, widgets.ReferenceField): |
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
231 |
attrs = field.rf |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
232 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
233 |
# If the field is hidden we display it elsewhere |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
234 |
if not bf.is_hidden: |
1820
ecc40aa58e19
Display a warning if there are errors on the form
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1815
diff
changeset
|
235 |
if bf.errors: |
ecc40aa58e19
Display a warning if there are errors on the form
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1815
diff
changeset
|
236 |
errors = True |
ecc40aa58e19
Display a warning if there are errors on the form
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1815
diff
changeset
|
237 |
|
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
238 |
example_text = '' |
1371
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
239 |
group = '0. ' |
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
240 |
|
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
241 |
if hasattr(field, 'group'): |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
242 |
group = field.group |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
243 |
|
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
244 |
if hasattr(field, 'example_text'): |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
245 |
example_text = force_unicode(field.example_text) |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
246 |
|
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
247 |
item = { |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
248 |
'field': bf, |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
249 |
'required': field.required, |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
250 |
'example_text': example_text, |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
251 |
'group': group, |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
252 |
} |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
253 |
|
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
254 |
item.update(attrs) |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
255 |
fields.append(item) |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
256 |
else: |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
257 |
hidden_fields.append(unicode(bf)) |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
258 |
|
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
259 |
for error in bf.errors: |
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
260 |
item = (name, force_unicode(error)) |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
261 |
hidden_fields_errors.append(item) |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
262 |
|
1371
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
263 |
grouped = dicts.groupby(fields, 'group') |
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
264 |
rexp = re.compile(r"\d+. ") |
1665
9d623ebfff0d
Fix too long lines, remove unused imports and variables, rename too short variables, add missing docstring and fix style in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1588
diff
changeset
|
265 |
fields = [(rexp.sub('', key), grouped[key]) for key in sorted(grouped)] |
1371
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
266 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
267 |
context.update({ |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
268 |
'top_errors': form.non_field_errors() or '', |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
269 |
'hidden_field_errors': hidden_fields_errors or '', |
1820
ecc40aa58e19
Display a warning if there are errors on the form
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1815
diff
changeset
|
270 |
'errors': errors, |
1371
2d97dbbb4d99
Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1360
diff
changeset
|
271 |
'groups': fields if fields else '', |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
272 |
'hidden_fields': hidden_fields or '', |
2277
96082450e62c
Fixed missing value in context when a form with a different name then form was used.
Lennard de Rijk
parents:
2192
diff
changeset
|
273 |
'form': form, |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
274 |
}) |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
275 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
276 |
return context |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
277 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
278 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
279 |
@register.inclusion_tag('soc/templatetags/_as_table_row.html', |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
280 |
takes_context=True) |
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
281 |
def as_table_row(context, item): |
835
1590625ead55
Add missing blank lines and dots in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
794
diff
changeset
|
282 |
"""Outputs a field as a properly formatted html row. |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
283 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
284 |
Args: |
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
285 |
item: the item that is being rendered |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
286 |
""" |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
287 |
|
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
288 |
return as_table_row_helper(context, item) |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
289 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
290 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
291 |
@register.inclusion_tag('soc/templatetags/_as_twoline_table_row.html', |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
292 |
takes_context=True) |
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
293 |
def as_twoline_table_row(context, item): |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
294 |
"""See as_table_row(). |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
295 |
""" |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
296 |
|
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
297 |
return as_table_row_helper(context, item) |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
298 |
|
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
299 |
|
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
300 |
def as_table_row_helper(context, item): |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
301 |
"""See as_table_row(). |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
302 |
""" |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
303 |
|
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
304 |
field = item['field'] |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
305 |
required = item['required'] |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
306 |
example_text = item['example_text'] |
835
1590625ead55
Add missing blank lines and dots in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
794
diff
changeset
|
307 |
|
1360
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
308 |
form = context['form'] |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
309 |
entity = context['entity'] |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
310 |
|
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
311 |
reference = item.get('reference_url') |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
312 |
filter = item.get('filter') |
f62c462037b6
Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1341
diff
changeset
|
313 |
filter_fields = item.get('filter_fields') |
785
c740d0129cce
Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents:
754
diff
changeset
|
314 |
|
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
315 |
# Escape and cache in local variable. |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
316 |
errors = [force_unicode(escape(error)) for error in field.errors] |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
317 |
|
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
318 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
319 |
if reference: |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
320 |
from soc.views.helper import redirects |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
321 |
params = { |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
322 |
'url_name': reference, |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
323 |
} |
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
324 |
|
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
325 |
if entity: |
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
326 |
args = {} |
1301
58f18ea60093
Added a filter_fields parameter to the ReferenceField widget
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1282
diff
changeset
|
327 |
for filter_field, filter_value in filter_fields.iteritems(): |
58f18ea60093
Added a filter_fields parameter to the ReferenceField widget
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1282
diff
changeset
|
328 |
args[filter_field] = filter_value |
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
329 |
for filter_field in (i for i in filter if hasattr(entity, i)): |
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
330 |
args[filter_field] = getattr(entity, filter_field) |
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
331 |
|
1271
3bd4a3b527d7
Add '__scoped__' as a special filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1229
diff
changeset
|
332 |
if '__scoped__' in filter: |
2160
3f9dd37d98a8
Use key().id_or_name() instead of key().name()
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2131
diff
changeset
|
333 |
args['scope_path'] = entity.key().id_or_name() |
1271
3bd4a3b527d7
Add '__scoped__' as a special filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1229
diff
changeset
|
334 |
|
2192
6eca3439f020
Fix too long line in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2160
diff
changeset
|
335 |
# TODO: replace this hack needed to get org-scoped mentor |
6eca3439f020
Fix too long line in soc.views.helper.templatetags.forms_helpers module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2160
diff
changeset
|
336 |
# autocompletion on student proposals |
2131
1d27ec29f1c7
Add a temporary hack to allow filtering on org.key().name()
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2077
diff
changeset
|
337 |
if '__org__' in filter: |
2160
3f9dd37d98a8
Use key().id_or_name() instead of key().name()
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2131
diff
changeset
|
338 |
args['scope_path'] = entity.org.key().id_or_name() |
2131
1d27ec29f1c7
Add a temporary hack to allow filtering on org.key().name()
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2077
diff
changeset
|
339 |
|
1229
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
340 |
params['args'] = '&'.join(['%s=%s' % item for item in args.iteritems()]) |
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
341 |
|
ec3768cbf369
Refactored the picker so that it is more generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1214
diff
changeset
|
342 |
select_url = redirects.getSelectRedirect(params) |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
343 |
|
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
344 |
if field.label: |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
345 |
label = escape(force_unicode(field.label)) |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
346 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
347 |
# Only add the suffix if the label does not end in punctuation. |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
348 |
if form.label_suffix and (label[-1] not in ':?.!'): |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
349 |
label += form.label_suffix |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
350 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
351 |
label = field.label_tag(label) or '' |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
352 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
353 |
field_class_type = 'formfield%slabel' % ('error' if errors else '') |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
354 |
|
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
355 |
help_text = field.help_text |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
356 |
|
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
357 |
context.update({ |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
358 |
'help_text': force_unicode(help_text) if help_text else '', |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
359 |
'field_class_type': field_class_type, |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
360 |
'label': force_unicode(label) if field.label else '', |
1271
3bd4a3b527d7
Add '__scoped__' as a special filter
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1229
diff
changeset
|
361 |
'field': field, |
1214
7fb705534dd1
Include the field_id in the context of _as_table_helper
Sverre Rabbelier <srabbelier@gmail.com>
parents:
959
diff
changeset
|
362 |
'field_id': field.auto_id, |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
363 |
'required': required, |
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
364 |
'example_text': example_text, |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
365 |
'select_url': select_url if reference else None, |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
728
diff
changeset
|
366 |
'errors': errors, |
935
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
367 |
}) |
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
368 |
|
09f47e08f805
Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents:
835
diff
changeset
|
369 |
return context |