-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5281320
commit 0e32093
Showing
5 changed files
with
16 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
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
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 |
---|---|---|
@@ -1,16 +1,6 @@ | ||
from django.forms.widgets import Select | ||
from django import forms | ||
|
||
|
||
class DataAttributesSelect(Select): | ||
|
||
def __init__(self, attrs=None, choices=(), data={}): | ||
super(DataAttributesSelect, self).__init__(attrs, choices) | ||
self.data = data | ||
|
||
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): # noqa | ||
option = super(DataAttributesSelect, self).create_option(name, value, label, selected, index, subindex=None, attrs=None) # noqa | ||
# adds the data-attributes to the attrs context var | ||
for data_attr, values in self.data.iteritems(): | ||
option['attrs'][data_attr] = values[option['value']] | ||
|
||
return option | ||
class MoratabEditor(forms.TextInput): | ||
template_name = 'editor/index.html' |