-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds advanced settins with own attributes; TODO migration file and re…
…nderin in template
- Loading branch information
1 parent
cb1a682
commit a148fff
Showing
4 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from djangocms_frontend.helpers import insert_fields | ||
|
||
|
||
class AttributesMixin: | ||
block_attr = { | ||
"description": _( | ||
"Advanced settings lets you add html attributes to render this element. Use them wisely and rarely." | ||
), | ||
"classes": ( | ||
"collapse", | ||
"attributes", | ||
), | ||
} | ||
|
||
def get_fieldsets(self, request, obj=None): | ||
meta = self.form._meta | ||
fields = ( | ||
[] | ||
) | ||
fields.append("attributes") | ||
return insert_fields( | ||
super().get_fieldsets(request, obj), | ||
fields, | ||
blockname=_("Advanced settings"), | ||
blockattrs=self.block_attr, | ||
position=-1, # Always last | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters