Skip to content

Commit

Permalink
further cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FinalAngel committed Sep 8, 2016
1 parent e0aa9dd commit 3bed5e0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ Changelog
=========


1.9.0 (unreleased)
==================

* Added additional settings
* Cleaned up file structure
* Removed Django < 1.8 support
* Adapted ``README.txt``
* Adapted fields
* Updated translations


1.8.3 (unreleased)
==================

Expand Down
11 changes: 8 additions & 3 deletions djangocms_link/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ class LinkPlugin(CMSPluginBase):
('external_link', 'internal_link'),
)
}),
(_('Link settings'), {
'classes': ('collapse',),
'fields': (
('mailto', 'phone'),
('anchor', 'target'),
)
}),
(_('Advanced settings'), {
'classes': ('collapse',),
'fields': (
'template',
('target', 'link_type'),
('anchor', 'styles'),
('mailto', 'phone'),
('styles', 'link_type'),
'attributes',
)
}),
Expand Down
10 changes: 8 additions & 2 deletions djangocms_link/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
class LinkForm(ModelForm):
try:
from djangocms_link.fields import PageSearchField
internal_link = PageSearchField(label=_('Page'), required=False)
internal_link = PageSearchField(
label=_('Page'),
required=False,
)
except ImportError:
from cms.forms.fields import PageSelectFormField
internal_link = PageSelectFormField(label=_('Page'), required=False)
internal_link = PageSelectFormField(
label=_('Page'),
required=False,
)

def for_site(self, site):
# override the internal_link fields queryset to contains just pages for
Expand Down
12 changes: 3 additions & 9 deletions djangocms_link/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,16 @@ def get_templates():
)
return choices

TYPE_CHOICES = (
('anchor', '<a>'),
('button', '<button>'),
) + getattr(
TYPE_CHOICES = getattr(
settings,
'DJANGOCMS_LINK_TYPES',
()
(('', '---------'),)
)

STYLE_CHOICES = getattr(
settings,
'DJANGOCMS_LINK_STYLES',
(
('', _('<not configured>')),
)
(('', '---------'),)
)

HOSTNAME = getattr(
Expand Down Expand Up @@ -131,7 +126,6 @@ class AbstractLink(CMSPlugin):
link_type = models.CharField(
verbose_name=_('Link type'),
choices=TYPE_CHOICES,
default=TYPE_CHOICES[0][0],
blank=True,
max_length=255,
)
Expand Down
1 change: 0 additions & 1 deletion djangocms_link/templates/djangocms_link/default/link.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
{{ instance.name }}
{% endfor %}
</a>
<br />
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# requirements from setup.py
Django-Select2
django-select2>=4.3,<5.0
# other requirements
djangocms-helper>=0.9.2,<0.10
tox
Expand Down

0 comments on commit 3bed5e0

Please sign in to comment.