forms.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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', 'adresse_zusatz', 'plz', '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('adresse_zusatz', css_class='col-sm-6 col-6'),
  219. css_class='form-row row'),
  220. Div(
  221. Div('plz', css_class='col-sm-6 col-6'),
  222. Div('ort', css_class='col-sm-6 col-6'),
  223. css_class='form-row row'),
  224. 'rechtsform','orga',
  225. Div(
  226. Div('website', css_class='col-sm-6 col-6'),
  227. Div('email', css_class='col-sm-6 col-6'),
  228. css_class='form-row row'),
  229. Div(
  230. Div('gruendungsjahr', css_class='col-sm-6 col-6'),
  231. Div('betriebgenommen', css_class='col-sm-6 col-6'),
  232. css_class='form-row row'),
  233. 'edit','public', 'mitmachen',
  234. ),
  235. )
  236. class Meta:
  237. model = Product
  238. fields = (
  239. 'terms',
  240. 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei', 'mitmachen','rechtsform','ort','orga',
  241. )
  242. def __init__(self,*args, **kwargs):
  243. super(ProductForm, self).__init__(*args, **kwargs)
  244. self.fields['orga'].widget = ListTextWidget(data_list=Product.ORGANIZATION, name='orga_list')
  245. self.fields['rechtsform'].widget = ListTextWidget(data_list=Product.RECHTSFORM, name='rechtsform_list')
  246. self.fields['beschreibung'].widget = TinyMCE(attrs={'cols': 80, 'rows': 30})
  247. self.fields['learning'].widget = TinyMCE(attrs={'cols': 80, 'rows': 30})
  248. self.fields['edit'].widget = HiddenInput()
  249. self.fields['public'].widget = HiddenInput()
  250. #
  251. # extend_help_text
  252. #
  253. self.fields['orga'].help_text = extend_help_text (self.fields['orga'].help_text, Product.ORGANIZATION)
  254. self.fields['rechtsform'].help_text = extend_help_text (self.fields['rechtsform'].help_text, Product.RECHTSFORM)
  255. self.helper = FormHelper()
  256. self.helper.form_tag = False
  257. class MobilitaetsForm(ProductForm):
  258. pass
  259. class WohnprojektForm(ProductForm):
  260. # terms = forms.BooleanField(required=True, label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
  261. class Meta:
  262. model = Wohnprojekt
  263. fields = ProductForm.product_fields + (
  264. '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',
  265. )
  266. def __init__(self,*args, **kwargs):
  267. super(WohnprojektForm, self).__init__(*args, **kwargs)
  268. #
  269. #
  270. self.fields['artmodell'].widget = ListTextWidget(data_list=Wohnprojekt.ARTMODELL, name='artmodell_list')
  271. self.fields['bautraeger'].widget = ListTextWidget(data_list=Wohnprojekt.BAUTRAEGER, name='bautraeger_list')
  272. self.fields['bauweise'].widget = ListTextWidget(data_list=Wohnprojekt.BAUWEISE, name='bauweise_list')
  273. self.fields['zielgruppen'].widget = ListTextWidget(data_list=Wohnprojekt.ZIELGRUPPEN, name='zielgruppen_list')
  274. self.fields['gprojekte'].widget = ListTextWidget(data_list=Wohnprojekt.GPROJEKTE, name='gprojekte_list')
  275. self.fields['freiraumangebote'].widget = ListTextWidget(data_list=Wohnprojekt.FREIANGEBOT, name='freiraumangebote_list')
  276. self.fields['gewerbe'].widget = ListTextWidget(data_list=Wohnprojekt.GEWERBE, name='gewerbe_list')
  277. #
  278. #
  279. self.fields['bauweise'].help_text = extend_help_text (self.fields['bauweise'].help_text, Wohnprojekt.BAUWEISE)
  280. self.fields['zielgruppen'].help_text = extend_help_text (self.fields['zielgruppen'].help_text, Wohnprojekt.ZIELGRUPPEN)
  281. self.fields['gprojekte'].help_text = extend_help_text (self.fields['gprojekte'].help_text, Wohnprojekt.GPROJEKTE)
  282. #
  283. #
  284. self.fields['frei'].label = "Wohnung Frei"
  285. self.fields['inseratstext'].label = "Inseratstext für Raumangebote"
  286. self.helper = FormHelper()
  287. self.helper.form_tag = False
  288. self.helper.layout = Layout(
  289. self.product_layout,
  290. Fieldset( 'Wohnprojekt',
  291. 'eigentum',
  292. 'artmodell',
  293. 'altneu',
  294. 'schwerpunkt',
  295. 'wohnbaufoerderung',
  296. 'bautraeger',
  297. 'architektur',
  298. Div(
  299. Div('aerwachsene', css_class='col-sm-6 col-6'),
  300. Div('akinder', css_class='col-sm-6 col-6'),
  301. css_class='form-row row'),
  302. 'awohnungen',
  303. 'gaestwohnungen',
  304. Fieldset ( 'Flächen',
  305. Div(
  306. Div('wohnflaeche', css_class='col-sm-3 col-3'),
  307. Div('gewerbeflaechen', css_class='col-sm-3 col-3'),
  308. Div('gemeinschaftsflaeche', css_class='col-sm-3 col-3'),
  309. Div('sonstige_flaechen', css_class='col-sm-3 col-3'),
  310. css_class='form-row row'),
  311. 'flaeche',
  312. 'kflaechen',
  313. ),
  314. Div(
  315. Div('gemeinschaftr', css_class='col-sm-6 col-6'),
  316. Div('raumangebot', css_class='col-sm-6 col-6'),
  317. Div('kgemeinschaftr', css_class='col-sm-6 col-6'),
  318. Div('kraumangebot', css_class='col-sm-6 col-6'),
  319. css_class='form-row row'),
  320. 'gewerbe',
  321. Div('inseratstext', css_class = "mab-field-highlight"),
  322. 'sonderwohnformen',
  323. Div(
  324. Div('parbeiten', css_class='col-sm-6 col-6'),
  325. Div('karbeiten', css_class='col-sm-6 col-6'),
  326. css_class='form-row row'),
  327. 'bauweise', 'zielgruppen', 'gprojekte', 'oekologie', 'freiraumangebote', 'urbanem',
  328. )
  329. )
  330. class MediaForm(FileFormMixin, forms.Form):
  331. image = UploadedFileField()
  332. name_for = forms.CharField()
  333. copyright = forms.CharField()
  334. #prefix = 'upload'
  335. def __init__(self, *args, **kwargs):
  336. super(MediaForm, self).__init__(*args, **kwargs)
  337. self.helper = FormHelper()
  338. self.helper.form_tag = False
  339. self.fields['name_for'].label = 'Bildbeschriftung'
  340. self.fields['copyright'].label = 'Urheberrechte'
  341. self.fields['image'].label = 'Bild oder Video'
  342. self.fields['image'].help_text = 'Bitte laden Sie Bilder im PNG- oder JPEG-Format hoch. Laden Sie Videos im MP4-Format hoch.'
  343. self.layout = Layout(
  344. Fieldset(
  345. (''),
  346. Div(
  347. Div('name_for', css_class='form-group col-md-6 mb-0'),
  348. Div('copyright', css_class='form-group col-md-4 mb-0')
  349. , css_class='form-row'),
  350. Div(
  351. Div('image', css_class='form-group col-md-6 mb-0'),
  352. css_class='form-row'),
  353. ))
  354. class VideoForm(forms.ModelForm):
  355. class Meta:
  356. model = Video
  357. fields = ('name_for','copyright','image')