Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
924930d2
Commit
924930d2
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Update the display value to be nicer for non js
parent
c58edfdb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addressfield/templates/addressfield/widgets/nested_with_label.html
+1
-1
1 addition, 1 deletion
...eld/templates/addressfield/widgets/nested_with_label.html
addressfield/widgets.py
+14
-5
14 additions, 5 deletions
addressfield/widgets.py
with
15 additions
and
6 deletions
addressfield/templates/addressfield/widgets/nested_with_label.html
+
1
−
1
View file @
924930d2
...
...
@@ -2,7 +2,7 @@
{% for widget in widget.subwidgets %}
{% if not widget.subwidgets %}
<div
class=
"form__item"
>
<label
for=
"{{ widget.attrs.id }}"
>
{{ widget.attrs.
class.title
}}
</label>
<label
for=
"{{ widget.attrs.id }}"
>
{{ widget.attrs.
display
}}
</label>
{% endif %}
{% include widget.template_name %}
...
...
This diff is collapsed.
Click to expand it.
addressfield/widgets.py
+
14
−
5
View file @
924930d2
...
...
@@ -20,18 +20,27 @@ class KeepAttrsTextInput(KeepOwnAttrsWidget, forms.TextInput):
pass
def
classify
(
field
):
return
field
.
replace
(
'
_
'
,
''
)
def
display
(
field
):
return
field
.
replace
(
'
_
'
,
'
'
).
title
()
class
NestedMultiWidget
(
KeepOwnAttrsWidget
,
forms
.
MultiWidget
):
template_name
=
'
addressfield/widgets/nested_with_label.html
'
def
__init__
(
self
,
*
args
,
**
kwargs
):
widgets
=
[
widget
(
attrs
=
{
'
class
'
:
field
,
'
required
'
:
False
})
for
field
,
widget
in
self
.
components
.
items
()
widget
(
attrs
=
{
'
class
'
:
classify
(
field
),
'
required
'
:
False
,
'
display
'
:
display
(
field
)})
for
field
,
widget
in
self
.
components
.
items
()
]
super
().
__init__
(
widgets
,
*
args
,
**
kwargs
)
@property
def
field_names
(
self
):
return
list
(
self
.
components
.
keys
()
)
return
[
classify
(
field
)
for
field
in
self
.
components
.
keys
()
]
def
decompress
(
self
,
value
):
if
value
:
...
...
@@ -58,9 +67,9 @@ class NestedMultiWidget(KeepOwnAttrsWidget, forms.MultiWidget):
class
LocalityWidget
(
NestedMultiWidget
):
components
=
{
'
localityname
'
:
KeepAttrsTextInput
,
'
administrativearea
'
:
KeepAttrsTextInput
,
'
postalcode
'
:
KeepAttrsTextInput
,
'
locality
_
name
'
:
KeepAttrsTextInput
,
'
administrative
_
area
'
:
KeepAttrsTextInput
,
'
postal
_
code
'
:
KeepAttrsTextInput
,
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment