0.4.12 prepare form wo descr
This commit is contained in:
@@ -20,3 +20,13 @@ class FeedbackForm(forms.Form):
|
|||||||
label=_('Принимаю пользовательское соглашение и принимаю условия обработки личных данных'),
|
label=_('Принимаю пользовательское соглашение и принимаю условия обработки личных данных'),
|
||||||
initial=False, required=True
|
initial=False, required=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
del_descr = False
|
||||||
|
if (kwargs and 'del_descr' in kwargs and kwargs['del_descr']) or (not 'desription' in kwargs['data']):
|
||||||
|
del_descr = True
|
||||||
|
if 'del_descr' in kwargs:
|
||||||
|
del kwargs['del_descr']
|
||||||
|
super(FeedbackForm, self).__init__(*args, **kwargs)
|
||||||
|
if del_descr:
|
||||||
|
del self.fields['description']
|
||||||
|
|||||||
@@ -13,20 +13,30 @@ def get_inter_Dict(user, context_Dict):
|
|||||||
from ServicesApp.funcs import get_sections
|
from ServicesApp.funcs import get_sections
|
||||||
sections = get_sections()
|
sections = get_sections()
|
||||||
|
|
||||||
|
page = None
|
||||||
|
page_scheme = None
|
||||||
|
hide_form_field_description = False
|
||||||
if 'page' in context_Dict and context_Dict['page']:
|
if 'page' in context_Dict and context_Dict['page']:
|
||||||
fb_block = context_Dict['page'].get_feedback_block()
|
page = context_Dict['page']
|
||||||
|
page_scheme = getattr(page, 'page_scheme', None)
|
||||||
|
|
||||||
|
fb_block = page.get_feedback_block()
|
||||||
if fb_block:
|
if fb_block:
|
||||||
form_name = fb_block.name
|
form_name = fb_block.name
|
||||||
|
|
||||||
if form_name:
|
if form_name:
|
||||||
|
kwargs_form = {}
|
||||||
from .forms import FeedbackForm
|
from .forms import FeedbackForm
|
||||||
feedback_form = FeedbackForm()
|
if page_scheme and page_scheme == 'plugin':
|
||||||
|
kwargs_form.update({'del_descr': True})
|
||||||
|
feedback_form = FeedbackForm(**kwargs_form)
|
||||||
feedback_form.initial = {'form_name': form_name}
|
feedback_form.initial = {'form_name': form_name}
|
||||||
Dict.update({'feedback_form': feedback_form})
|
Dict.update({'feedback_form': feedback_form})
|
||||||
|
|
||||||
Dict.update({
|
Dict.update({
|
||||||
'sections': sections,
|
'sections': sections,
|
||||||
'logo': get_logo_url(),
|
'logo': get_logo_url(),
|
||||||
|
'hide_form_field_description': hide_form_field_description
|
||||||
})
|
})
|
||||||
# from SubscribesApp.funcs import get_cur_user_subscribe
|
# from SubscribesApp.funcs import get_cur_user_subscribe
|
||||||
# user_subscribe = get_cur_user_subscribe(user)
|
# user_subscribe = get_cur_user_subscribe(user)
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<input oninput="deleteErrorsInput(this)" class="input_form_feedback{% if feedback_form.errors.contacts %} error{% endif %} el_form_feedback" id="id_contacts" name="contacts" placeholder="{{ feedback_form.contacts.label }}"{% if feedback_form.initial.contacts %} value="{{ feedback_form.initial.contacts }}"{% endif %}>
|
<input oninput="deleteErrorsInput(this)" class="input_form_feedback{% if feedback_form.errors.contacts %} error{% endif %} el_form_feedback" id="id_contacts" name="contacts" placeholder="{{ feedback_form.contacts.label }}"{% if feedback_form.initial.contacts %} value="{{ feedback_form.initial.contacts }}"{% endif %}>
|
||||||
{% if feedback_form.errors.contacts %}<div class="error_input_html">{{ feedback_form.errors.contacts }}</div>{% endif %}
|
{% if feedback_form.errors.contacts %}<div class="error_input_html">{{ feedback_form.errors.contacts }}</div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if not page.page_scheme == 'plugin' %}
|
|
||||||
|
{% if feedback_form.fields.description %}
|
||||||
<div>
|
<div>
|
||||||
<label class="label_feedback_form{% if feedback_form.errors.description %} error{% endif %} standart_txt" for="id_description">{{ feedback_form.description.label }}</label>
|
<label class="label_feedback_form{% if feedback_form.errors.description %} error{% endif %} standart_txt" for="id_description">{{ feedback_form.description.label }}</label>
|
||||||
<textarea oninput="deleteErrorsInput(this)" class="textarea_form_feedback{% if feedback_form.errors.description %} error{% endif %} el_form_feedback" id="id_description" name="description">{% if feedback_form.initial.description %}{{ feedback_form.initial.description }}{% endif %}</textarea>
|
<textarea oninput="deleteErrorsInput(this)" class="textarea_form_feedback{% if feedback_form.errors.description %} error{% endif %} el_form_feedback" id="id_description" name="description">{% if feedback_form.initial.description %}{{ feedback_form.initial.description }}{% endif %}</textarea>
|
||||||
|
|||||||
Reference in New Issue
Block a user