forms.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. from django import forms
  2. from django.conf import settings
  3. from django.core.files import File
  4. from django.contrib.auth.forms import UserCreationForm
  5. from django_file_form.forms import UploadedFileField, FileFormMixin, CharField, MultipleUploadedFileField
  6. from django.contrib.auth.models import User
  7. from django.urls import reverse, reverse_lazy
  8. from django.forms import *
  9. from django.forms.widgets import HiddenInput
  10. from django.forms.models import inlineformset_factory
  11. # from django.views.generic.edit.FormMixin
  12. # from crispy_forms.layout.buttons import Submit, InputButton
  13. from crispy_forms.layout import Layout, Field, Fieldset, Div, Row, Column, HTML, ButtonHolder, Submit
  14. from crispy_forms.bootstrap import InlineField
  15. from crispy_forms.helper import FormHelper
  16. from captcha.fields import CaptchaField
  17. from tinymce.widgets import TinyMCE
  18. from newsletter.forms import *
  19. from marktplatz.widgets import *
  20. from .models import *
  21. from .urls import *
  22. def extend_help_text( help_text, myList ):
  23. extended_text = help_text
  24. extended_text += " z.B. "
  25. for x in myList:
  26. extended_text += x[1] + ", "
  27. extended_text = extended_text[:-2]
  28. extended_text += "."
  29. return extended_text
  30. class GeneralFields(forms.Form):
  31. terms = forms.BooleanField(required=True, )
  32. def __init__(self, *args, **kwargs):
  33. super(GeneralFields, self).__init__(*args, **kwargs)
  34. drurl = reverse_lazy( 'pages-generic', kwargs= { 'page': 'DATENSCHUTZRICHTLINIE' } )
  35. tmurl = reverse_lazy( 'pages-generic', kwargs= { 'page': 'TEILNAHME' } )
  36. self.fields ['terms'].label = 'Ich akzeptiere die <a target="_blank" href="{}"> Datenschutzrichtlinie</a> sowie die <a target="_blank" href="{}"> Teilnahmebedingungen</a> und habe sie gelesen.'.format(drurl, tmurl)
  37. class textSearchForm(forms.Form):
  38. mywidget = forms.TextInput( attrs={'onfocus': "this.value=''", 'class' : "border-thin"} )
  39. searchText = forms.CharField ( label='', widget = mywidget, max_length = 2048, min_length=3, empty_value="Suche...", initial='Suche...' )
  40. def __init__(self, *args, **kwargs):
  41. super(textSearchForm, self).__init__(*args, **kwargs)
  42. self.helper = FormHelper()
  43. self.helper.form_tag = False
  44. self.helper.layout = Layout(
  45. Div(
  46. Div('searchText', css_class='col-sm-6 col-6'),
  47. Div(
  48. ButtonHolder(
  49. Submit('submit', 'Suche', css_class='border-thin mybtn')
  50. ),
  51. css_class='col-sm-6 col-6'),
  52. css_class='form-row row mab-search-bar'),
  53. )
  54. class searchAgentForm(forms.ModelForm):
  55. agent_layout = Layout()
  56. class Meta:
  57. model = SearchAgent
  58. fields = ('ort', 'email')
  59. def __init__(self,*args, **kwargs):
  60. super().__init__(*args, **kwargs)
  61. # self.fields['ort'].widget = CheckboxSelectMultiple( attrs= { 'style' : "min-height: 250px;"} )
  62. self.agent_layout = Layout(
  63. Fieldset(
  64. ('Suchagent einrichten'),
  65. # 'ort',
  66. Div(
  67. Div('ort', css_class='col-sm-6 col-6 checkbox-ort'),
  68. Div(
  69. HTML("""
  70. <button onclick=" ganz_wien()" class="btn btn-primary border-thin border-dark mybtn">Ganz Wien</button>
  71. <script>
  72. function ganz_wien(){
  73. $(".checkbox-ort .custom-control-label:contains('Wien')").each(function() {
  74. $this = $(this);
  75. var selector = "#" + $this.attr('for') ;
  76. $( selector ).prop('checked', true);
  77. });
  78. }
  79. </script>
  80. <br>
  81. """),
  82. # HTML("""
  83. # <div id="div_id_ort" class="form-group">
  84. # <label for="" class=" requiredField">Ort<span class="asteriskField">*</span> </label>
  85. # <div class="">
  86. # <div class="row">
  87. # <div class="col-sm-6 col-6 checkbox-ort">
  88. #
  89. # <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_1" value="1010" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_1">
  90. # Wien 1
  91. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_2" value="1020" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_2">
  92. # Wien 2
  93. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_3" value="1030" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_3">
  94. # Wien 3
  95. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_4" value="1040" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_4">
  96. # Wien 4
  97. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_5" value="1050" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_5">
  98. # Wien 5
  99. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_6" value="1060" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_6">
  100. # Wien 6
  101. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_7" value="1070" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_7">
  102. # Wien 7
  103. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_8" value="1080" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_8">
  104. # Wien 8
  105. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_9" value="1090" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_9">
  106. # Wien 9
  107. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_10" value="1100" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_10">
  108. # Wien 10
  109. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_11" value="1110" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_11">
  110. # Wien 11
  111. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_12" value="1120" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_12">
  112. # Wien 12
  113. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_13" value="1130" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_13">
  114. # Wien 13
  115. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_14" value="1140" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_14">
  116. # Wien 14
  117. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_15" value="1150" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_15">
  118. # Wien 15
  119. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_16" value="1160" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_16">
  120. # Wien 16
  121. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_17" value="1170" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_17">
  122. # Wien 17
  123. # </label> </div>
  124. # </div>
  125. # <div class="col-sm-6 col-6 checkbox-ort">
  126. #
  127. #
  128. # <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_18" value="1180" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_18">
  129. # Wien 18
  130. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_19" value="1190" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_19">
  131. # Wien 19
  132. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_20" value="1200" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_20">
  133. # Wien 20
  134. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_21" value="1210" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_21">
  135. # Wien 21
  136. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_22" value="1220" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_22">
  137. # Wien 22
  138. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_23" value="1230" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_23">
  139. # Wien 23
  140. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_24" value="GERM" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_24">
  141. # Deutschland
  142. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_25" value="SCHW" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_25">
  143. # Schweiz
  144. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_26" value="VORA" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_26">
  145. # Vorarlberg
  146. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_27" value="TIRO" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_27">
  147. # Tirol
  148. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_28" value="SALZ" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_28">
  149. # Salzburg
  150. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_29" value="KAER" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_29">
  151. # Kärnten
  152. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_30" value="STEI" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_30">
  153. # Steiermark
  154. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_31" value="OBER" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_31">
  155. # Oberösterreich
  156. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_32" value="NIER" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_32">
  157. # Niederösterreich
  158. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_33" value="BURG" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_33">
  159. # Burgenland
  160. # </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_34" value="WELT" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_34">
  161. # Welt
  162. # </label> </div>
  163. # </div>
  164. # </div>
  165. # <small id="hint_id_ort" class="form-text text-muted">Ort des Projektes</small>
  166. # </div>
  167. # </div>
  168. #
  169. # """),
  170. css_class='col-sm-6 col-6'),
  171. css_class='form-row row'),
  172. ),
  173. )
  174. class AgentNewslwtterForm( searchAgentForm, GeneralFields):
  175. email_field = forms.EmailField( label = 'Email', help_text="Du kannst den Suchagenten und den Newsletter jederzeit abbestellen - über einen Link in den Mails.", required=True, max_length=254 )
  176. subscribe = forms.BooleanField( label = 'Newsletter abonnieren', help_text='', required = False )
  177. captcha = CaptchaField( label = 'Bitte lösen Sie die Gleichung', generator='captcha.helpers.math_challenge' )
  178. def __init__(self, *args, **kwargs):
  179. # super(searchAgentForm, self).__init__(*args, **kwargs)
  180. super(AgentNewslwtterForm, self).__init__(*args, **kwargs)
  181. self.helper = FormHelper(self)
  182. self.helper.attrs = { 'enctype' : "multipart/form-data" }
  183. self.helper.form_action = reverse('agent-newsletter-create', kwargs={'newsletter_slug': "gemeinschaffen-newsletter"} )
  184. self.helper.layout = Layout(
  185. self.agent_layout,
  186. 'email_field',
  187. 'subscribe',
  188. 'terms',
  189. 'captcha',
  190. ButtonHolder(
  191. Submit('submit', 'Suchagent aktivieren', css_class='border-thin border-dark mybtn')
  192. ),
  193. )
  194. class RegisterForm(forms.ModelForm, GeneralFields):
  195. class Meta:
  196. model = Contact
  197. fields = ('first_name','last_name','email','adress','postcode','city','country',
  198. 'phonenumber','alternate_phonenumber','skype_name','website', 'terms')
  199. class SignUpForm(UserCreationForm):
  200. captcha = CaptchaField( generator='captcha.helpers.math_challenge' )
  201. class Meta:
  202. model = User
  203. fields = ('username', 'password1', 'password2')
  204. class ProductForm(forms.ModelForm, GeneralFields):
  205. # terms = forms.BooleanField(required=True, label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
  206. product_fields = ( 'terms', 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei','ort','rechtsform','orga','mitmachen','edit','public', )
  207. product_layout = Layout(
  208. Fieldset(
  209. ('Über dein Projekt'),
  210. 'name','claim','beschreibung',
  211. Div(
  212. Div('frei', css_class='col-sm-6 col-6 '),
  213. Div('kfrei', css_class='col-sm-6 col-6 ' ),
  214. css_class='form-row row mab-field-highlight'),
  215. 'learning','status',
  216. Div(
  217. Div('adresse', css_class='col-sm-6 col-6'),
  218. Div('ort', css_class='col-sm-6 col-6'),
  219. css_class='form-row row'),
  220. 'rechtsform','orga',
  221. Div(
  222. Div('website', css_class='col-sm-6 col-6'),
  223. Div('email', css_class='col-sm-6 col-6'),
  224. css_class='form-row row'),
  225. Div(
  226. Div('gruendungsjahr', css_class='col-sm-6 col-6'),
  227. Div('betriebgenommen', css_class='col-sm-6 col-6'),
  228. css_class='form-row row'),
  229. 'edit','public', 'mitmachen',
  230. ),
  231. )
  232. class Meta:
  233. model = Product
  234. fields = (
  235. 'terms',
  236. 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei', 'mitmachen','rechtsform','ort','orga',
  237. )
  238. def __init__(self,*args, **kwargs):
  239. super(ProductForm, self).__init__(*args, **kwargs)
  240. self.fields['orga'].widget = ListTextWidget(data_list=Product.ORGANIZATION, name='orga_list')
  241. self.fields['rechtsform'].widget = ListTextWidget(data_list=Product.RECHTSFORM, name='rechtsform_list')
  242. self.fields['beschreibung'].widget = TinyMCE(attrs={'cols': 80, 'rows': 30})
  243. self.fields['learning'].widget = TinyMCE(attrs={'cols': 80, 'rows': 30})
  244. self.fields['edit'].widget = HiddenInput()
  245. self.fields['public'].widget = HiddenInput()
  246. #
  247. # extend_help_text
  248. #
  249. self.fields['orga'].help_text = extend_help_text (self.fields['orga'].help_text, Product.ORGANIZATION)
  250. self.fields['rechtsform'].help_text = extend_help_text (self.fields['rechtsform'].help_text, Product.RECHTSFORM)
  251. self.helper = FormHelper()
  252. self.helper.form_tag = False
  253. class WohnprojektForm(ProductForm):
  254. terms = forms.BooleanField(required=True, label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
  255. class Meta:
  256. model = Wohnprojekt
  257. fields = ProductForm.product_fields + (
  258. 'eigentum', 'inseratstext', 'altneu', 'schwerpunkt', 'wohnbaufoerderung', 'artmodell', 'bautraeger', 'architektur', 'aerwachsene', 'akinder', 'awohnungen', 'wohnflaeche', 'gewerbeflaechen', 'gemeinschaftsflaeche', 'sonstige_flaechen', 'flaeche', 'kflaechen', 'gemeinschaftr', 'kgemeinschaftr', 'gewerbe', 'sonderwohnformen', 'raumangebot', 'kraumangebot', 'parbeiten', 'karbeiten', 'bauweise', 'zielgruppen', 'gprojekte', 'oekologie', 'freiraumangebote', 'gaestwohnungen', 'urbanem',
  259. )
  260. def __init__(self,*args, **kwargs):
  261. super(WohnprojektForm, self).__init__(*args, **kwargs)
  262. #
  263. #
  264. self.fields['artmodell'].widget = ListTextWidget(data_list=Wohnprojekt.ARTMODELL, name='artmodell_list')
  265. self.fields['bautraeger'].widget = ListTextWidget(data_list=Wohnprojekt.BAUTRAEGER, name='bautraeger_list')
  266. self.fields['bauweise'].widget = ListTextWidget(data_list=Wohnprojekt.BAUWEISE, name='bauweise_list')
  267. self.fields['zielgruppen'].widget = ListTextWidget(data_list=Wohnprojekt.ZIELGRUPPEN, name='zielgruppen_list')
  268. self.fields['gprojekte'].widget = ListTextWidget(data_list=Wohnprojekt.GPROJEKTE, name='gprojekte_list')
  269. self.fields['freiraumangebote'].widget = ListTextWidget(data_list=Wohnprojekt.FREIANGEBOT, name='freiraumangebote_list')
  270. self.fields['gewerbe'].widget = ListTextWidget(data_list=Wohnprojekt.GEWERBE, name='gewerbe_list')
  271. #
  272. #
  273. self.fields['bauweise'].help_text = extend_help_text (self.fields['bauweise'].help_text, Wohnprojekt.BAUWEISE)
  274. self.fields['zielgruppen'].help_text = extend_help_text (self.fields['zielgruppen'].help_text, Wohnprojekt.ZIELGRUPPEN)
  275. self.fields['gprojekte'].help_text = extend_help_text (self.fields['gprojekte'].help_text, Wohnprojekt.GPROJEKTE)
  276. #
  277. #
  278. self.fields['frei'].label = "Wohnung Frei"
  279. self.fields['inseratstext'].label = "Inseratstext für Raumangebote"
  280. self.helper = FormHelper()
  281. self.helper.form_tag = False
  282. self.helper.layout = Layout(
  283. self.product_layout,
  284. Fieldset( 'Wohnprojekt',
  285. 'eigentum',
  286. 'artmodell',
  287. 'altneu',
  288. 'schwerpunkt',
  289. 'wohnbaufoerderung',
  290. 'bautraeger',
  291. 'architektur',
  292. Div(
  293. Div('aerwachsene', css_class='col-sm-6 col-6'),
  294. Div('akinder', css_class='col-sm-6 col-6'),
  295. css_class='form-row row'),
  296. 'awohnungen',
  297. 'gaestwohnungen',
  298. Fieldset ( 'Flächen',
  299. Div(
  300. Div('wohnflaeche', css_class='col-sm-3 col-3'),
  301. Div('gewerbeflaechen', css_class='col-sm-3 col-3'),
  302. Div('gemeinschaftsflaeche', css_class='col-sm-3 col-3'),
  303. Div('sonstige_flaechen', css_class='col-sm-3 col-3'),
  304. css_class='form-row row'),
  305. 'flaeche',
  306. 'kflaechen',
  307. ),
  308. Div(
  309. Div('gemeinschaftr', css_class='col-sm-6 col-6'),
  310. Div('raumangebot', css_class='col-sm-6 col-6'),
  311. Div('kgemeinschaftr', css_class='col-sm-6 col-6'),
  312. Div('kraumangebot', css_class='col-sm-6 col-6'),
  313. css_class='form-row row'),
  314. 'gewerbe',
  315. Div('inseratstext', css_class = "mab-field-highlight"),
  316. 'sonderwohnformen',
  317. Div(
  318. Div('parbeiten', css_class='col-sm-6 col-6'),
  319. Div('karbeiten', css_class='col-sm-6 col-6'),
  320. css_class='form-row row'),
  321. 'bauweise', 'zielgruppen', 'gprojekte', 'oekologie', 'freiraumangebote', 'urbanem',
  322. )
  323. )
  324. class MediaForm(FileFormMixin, forms.Form):
  325. image = UploadedFileField()
  326. name_for = forms.CharField()
  327. copyright = forms.CharField()
  328. #prefix = 'upload'
  329. def __init__(self, *args, **kwargs):
  330. super(MediaForm, self).__init__(*args, **kwargs)
  331. self.helper = FormHelper()
  332. self.helper.form_tag = False
  333. self.fields['name_for'].label = 'Bildbeschriftung'
  334. self.fields['copyright'].label = 'Urheberrechte'
  335. self.fields['image'].label = 'Bild oder Video'
  336. self.fields['image'].help_text = 'Bitte laden Sie Bilder im PNG- oder JPEG-Format hoch. Laden Sie Videos im MP4-Format hoch.'
  337. self.layout = Layout(
  338. Fieldset(
  339. (''),
  340. Div(
  341. Div('name_for', css_class='form-group col-md-6 mb-0'),
  342. Div('copyright', css_class='form-group col-md-4 mb-0')
  343. , css_class='form-row'),
  344. Div(
  345. Div('image', css_class='form-group col-md-6 mb-0'),
  346. css_class='form-row'),
  347. ))
  348. class VideoForm(forms.ModelForm):
  349. class Meta:
  350. model = Video
  351. fields = ('name_for','copyright','image')