0001-manager-keep-link-label-attribute-on-main-tab-65878.patch
combo/data/forms.py | ||
---|---|---|
42 | 42 |
class LinkCellForm(forms.ModelForm): |
43 | 43 |
class Meta: |
44 | 44 |
model = LinkCell |
45 |
fields = ('url', 'link_page', 'anchor') |
|
45 |
fields = ('title', 'url', 'link_page', 'anchor')
|
|
46 | 46 | |
47 | 47 |
def __init__(self, *args, **kwargs): |
48 | 48 |
super().__init__(*args, **kwargs) |
combo/data/models.py | ||
---|---|---|
1586 | 1586 | |
1587 | 1587 |
@register_cell_class |
1588 | 1588 |
class LinkCell(CellBase): |
1589 |
title = models.CharField(_('Title'), max_length=150, blank=True)
|
|
1589 |
title = models.CharField(_('Label'), max_length=150, blank=True)
|
|
1590 | 1590 |
url = models.CharField(_('URL'), max_length=2000, blank=True, validators=[django_template_validator]) |
1591 | 1591 |
link_page = models.ForeignKey( |
1592 | 1592 |
'data.Page', |
... | ... | |
1683 | 1683 |
extra_context['url'] = url |
1684 | 1684 |
return extra_context |
1685 | 1685 | |
1686 |
def get_appearance_fields(self): |
|
1687 |
# keep title/label on main tab |
|
1688 |
return [] |
|
1689 | ||
1686 | 1690 |
def get_default_form_class(self): |
1687 | 1691 |
from .forms import LinkCellForm |
1688 | 1692 |
tests/test_manager.py | ||
---|---|---|
2632 | 2632 |
app = login(app) |
2633 | 2633 |
resp = app.get('/manage/pages/%s/' % page.pk) |
2634 | 2634 | |
2635 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]')
|
|
2636 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
2635 |
assert resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
2636 |
assert not resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]')
|
|
2637 | 2637 | |
2638 | 2638 | |
2639 | 2639 |
def test_link_cell_validation(): |
2640 |
- |