Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. @WysiwygDecorator(incipit={'chars': 200}, content={})
  2. class TourTextAplaForm(TourSlideElementBaseForm):
  3.     #audio_elfinder = ElFinderField(label=_(u'Opis audio'),
  4.     #    widget=ElFinderWidget(attrs={'data-process_type': 'audio'}),
  5.     #    required=False)
  6.  
  7.     class Meta:
  8.         model = TourSlideTextElement
  9.         widgets = {
  10.             'pos_left': forms.HiddenInput(),
  11.             'pos_top': forms.HiddenInput(),
  12.             'pos_width': forms.HiddenInput(),
  13.             'pos_height': forms.HiddenInput(),
  14.             'slide': forms.HiddenInput(),
  15.             'incipit': forms.Textarea(attrs={'cols': 37, 'rows': 5}),
  16.             'content' : forms.Textarea(attrs={'cols': 37, 'rows': 5}),
  17.         }
  18.         exclude = ("audio_file", )
  19.  
  20.     def __init__(self, *args, **kwargs):
  21.         self.exhibition = kwargs.pop("exhibition")
  22.         super(TourTextAplaForm, self).__init__(*args, **kwargs)
  23.         #if self.instance.pk is not None and self.instance.audio_file:
  24.         #    self.fields['audio_elfinder'].initial = self.instance.audio_file
  25.  
  26.     def save(self, commit=True):
  27.         instance = super(TourTextAplaForm, self).save(False)
  28.         #if self.cleaned_data["audio_elfinder"]:
  29.         #    instance.audio_file = self.cleaned_data["audio_elfinder"]
  30.         return super(TourTextAplaForm, self).save(commit)
  31.  
  32.     def set_default_size(self):
  33.         self.fields['pos_width'].initial = 160
  34.         self.fields['pos_height'].initial = 60
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement