|
|
@@ -14,26 +14,18 @@ from django import forms
|
|
|
from captcha.fields import CaptchaField
|
|
|
from django.core.files import File
|
|
|
from marktplatz.widgets import *
|
|
|
+from django.forms.widgets import HiddenInput
|
|
|
|
|
|
|
|
|
-class VoteForm(forms.Form):
|
|
|
- aestethic = forms.DecimalField(label='Aesthetic Qualities', max_value=10, decimal_places =1,required=False)
|
|
|
- innovation = forms.DecimalField(label='Innovative Elements',max_value=10, decimal_places =1,required=False)
|
|
|
- technical = forms.DecimalField(label='Technical Qualities', max_value=10, decimal_places =1,required=False)
|
|
|
- integration = forms.DecimalField(label='Integration of diffrent Components',
|
|
|
- max_value=10, decimal_places=1,
|
|
|
- help_text='e.g. architecture,display and content',required=False)
|
|
|
- comment = forms.CharField(max_length=300, widget=forms.Textarea(), help_text = 'You can leave your written comment here!',required=False)
|
|
|
-
|
|
|
- def clean(self):
|
|
|
- cleaned_data = super(VoteForm, self).clean()
|
|
|
- aestethic =cleaned_data.get('aestethic')
|
|
|
- innovation = cleaned_data.get('innovation')
|
|
|
- technical = cleaned_data.get('technical')
|
|
|
- integration = cleaned_data.get('integration')
|
|
|
- comment = cleaned_data.get('comment')
|
|
|
+def extend_help_text( help_text, myList ):
|
|
|
+ extended_text = help_text
|
|
|
+ extended_text += " z.B. "
|
|
|
+ for x in myList:
|
|
|
+ extended_text += x[1] + ", "
|
|
|
+ extended_text = extended_text[:-2]
|
|
|
+ extended_text += "."
|
|
|
+ return extended_text
|
|
|
|
|
|
- #initial can be specified with old value in db maybe
|
|
|
|
|
|
class searchAgentForm(forms.ModelForm):
|
|
|
|
|
|
@@ -57,38 +49,78 @@ class SignUpForm(UserCreationForm):
|
|
|
model = User
|
|
|
fields = ('username', 'password1', 'password2')
|
|
|
|
|
|
+class ProductForm(forms.ModelForm):
|
|
|
+
|
|
|
+ terms = forms.BooleanField(required=True, label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
|
|
|
+ product_fields = ( 'terms', 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei','ort','rechtsform','orga','mitmachen','edit','public', )
|
|
|
+ product_layout = Layout(
|
|
|
+ Fieldset(
|
|
|
+ ('Über dein Projekt'),
|
|
|
+ 'name','claim','beschreibung','learning','status',
|
|
|
+ Div(
|
|
|
+ Div('adresse', css_class='col-sm-6 col-6'),
|
|
|
+ Div('ort', css_class='col-sm-6 col-6'),
|
|
|
+ css_class='form-row row'),
|
|
|
+ Div(
|
|
|
+ Div('frei', css_class='col-sm-6 col-6'),
|
|
|
+ Div('kfrei', css_class='col-sm-6 col-6'),
|
|
|
+ css_class='form-row row'),
|
|
|
+ 'mitmachen','rechtsform','orga',
|
|
|
+ Div(
|
|
|
+ Div('website', css_class='col-sm-6 col-6'),
|
|
|
+ Div('email', css_class='col-sm-6 col-6'),
|
|
|
+ css_class='form-row row'),
|
|
|
+ Div(
|
|
|
+ Div('gruendungsjahr', css_class='col-sm-6 col-6'),
|
|
|
+ Div('betriebgenommen', css_class='col-sm-6 col-6'),
|
|
|
+ css_class='form-row row'),
|
|
|
+ 'edit','public',
|
|
|
+ ),
|
|
|
+ )
|
|
|
|
|
|
+ class Meta:
|
|
|
+ model = Product
|
|
|
+ fields = (
|
|
|
+ 'terms',
|
|
|
+ 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei', 'mitmachen','rechtsform','ort','orga',
|
|
|
+ )
|
|
|
|
|
|
-def extend_help_text( help_text, myList ):
|
|
|
- extended_text = help_text
|
|
|
- extended_text += " z.B. "
|
|
|
- for x in myList:
|
|
|
- extended_text += x[1] + ", "
|
|
|
- extended_text = extended_text[:-2]
|
|
|
- extended_text += "."
|
|
|
- return extended_text
|
|
|
|
|
|
-class SubmissionForm(forms.ModelForm):
|
|
|
+
|
|
|
+ def __init__(self,*args, **kwargs):
|
|
|
+ super(ProductForm, self).__init__(*args, **kwargs)
|
|
|
+
|
|
|
+ self.fields['orga'].widget = ListTextWidget(data_list=Product.ORGANIZATION, name='orga_list')
|
|
|
+ self.fields['rechtsform'].widget = ListTextWidget(data_list=Product.RECHTSFORM, name='rechtsform_list')
|
|
|
+ self.fields['edit'].widget = HiddenInput()
|
|
|
+ self.fields['public'].widget = HiddenInput()
|
|
|
+ #
|
|
|
+ # extend_help_text
|
|
|
+ #
|
|
|
+ self.fields['orga'].help_text = extend_help_text (self.fields['orga'].help_text, Product.ORGANIZATION)
|
|
|
+ self.fields['rechtsform'].help_text = extend_help_text (self.fields['rechtsform'].help_text, Product.RECHTSFORM)
|
|
|
+
|
|
|
+ self.helper = FormHelper()
|
|
|
+ self.helper.form_tag = False
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+class WohnprojektForm(ProductForm):
|
|
|
|
|
|
terms = forms.BooleanField(required=True, label= ('I accept and have read the Terms of Participation.'))
|
|
|
|
|
|
class Meta:
|
|
|
model = Wohnprojekt
|
|
|
- fields = (
|
|
|
- # 'title','country','city','year','owner','teaser_txt','header','category', 'description_txt',
|
|
|
- 'terms',
|
|
|
- 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei', 'mitmachen','rechtsform','ort','orga',
|
|
|
+ fields = ProductForm.product_fields + (
|
|
|
'eigentum', 'inseratstext', 'altneu', 'schwerpunkt', 'wohnbaufoerderung', 'artmodell', 'bautraeger', 'aerwachsene', 'akinder', 'awohnungen', 'wohnflaeche', 'gewerbeflaechen', 'gemeinschaftsflaeche', 'sonstige_flaechen', 'kflaechen', 'gemeinschaftr', 'kgemeinschaftr', 'sonderwohnformen', 'raumangebot', 'kraumangebot', 'parbeiten', 'karbeiten', 'bauweise', 'zielgruppen', 'gprojekte', 'oekologie', 'freiraumangebote', 'gaestwohnungen',
|
|
|
)
|
|
|
|
|
|
|
|
|
def __init__(self,*args, **kwargs):
|
|
|
- super(SubmissionForm, self).__init__(*args, **kwargs)
|
|
|
+ super(WohnprojektForm, self).__init__(*args, **kwargs)
|
|
|
|
|
|
#
|
|
|
#
|
|
|
- self.fields['orga'].widget = ListTextWidget(data_list=Product.ORGANIZATION, name='orga_list')
|
|
|
- self.fields['rechtsform'].widget = ListTextWidget(data_list=Product.RECHTSFORM, name='rechtsform_list')
|
|
|
self.fields['artmodell'].widget = ListTextWidget(data_list=Wohnprojekt.ARTMODELL, name='artmodell_list')
|
|
|
self.fields['bautraeger'].widget = ListTextWidget(data_list=Wohnprojekt.BAUTRAEGER, name='bautraeger_list')
|
|
|
self.fields['bauweise'].widget = ListTextWidget(data_list=Wohnprojekt.BAUWEISE, name='bauweise_list')
|
|
|
@@ -96,8 +128,6 @@ class SubmissionForm(forms.ModelForm):
|
|
|
self.fields['gprojekte'].widget = ListTextWidget(data_list=Wohnprojekt.GPROJEKTE, name='gprojekte_list')
|
|
|
#
|
|
|
#
|
|
|
- self.fields['orga'].help_text = extend_help_text (self.fields['orga'].help_text, Product.ORGANIZATION)
|
|
|
- self.fields['rechtsform'].help_text = extend_help_text (self.fields['rechtsform'].help_text, Product.RECHTSFORM)
|
|
|
self.fields['bauweise'].help_text = extend_help_text (self.fields['bauweise'].help_text, Wohnprojekt.BAUWEISE)
|
|
|
self.fields['zielgruppen'].help_text = extend_help_text (self.fields['zielgruppen'].help_text, Wohnprojekt.ZIELGRUPPEN)
|
|
|
self.fields['gprojekte'].help_text = extend_help_text (self.fields['gprojekte'].help_text, Wohnprojekt.GPROJEKTE)
|
|
|
@@ -107,34 +137,10 @@ class SubmissionForm(forms.ModelForm):
|
|
|
self.helper = FormHelper()
|
|
|
self.helper.form_tag = False
|
|
|
self.helper.layout = Layout(
|
|
|
- Fieldset(
|
|
|
- ('Über dein Projekt'),
|
|
|
-
|
|
|
- 'name','claim','beschreibung','learning','status',
|
|
|
-
|
|
|
- Div(
|
|
|
- Div('adresse', css_class='col-sm-6 col-6'),
|
|
|
- Div('ort', css_class='col-sm-6 col-6'),
|
|
|
- css_class='form-row row'),
|
|
|
-
|
|
|
- Div(
|
|
|
- Div('frei', css_class='col-sm-6 col-6'),
|
|
|
- Div('kfrei', css_class='col-sm-6 col-6'),
|
|
|
- css_class='form-row row'),
|
|
|
-
|
|
|
- 'mitmachen','rechtsform','orga',
|
|
|
-
|
|
|
- Div(
|
|
|
- Div('website', css_class='col-sm-6 col-6'),
|
|
|
- Div('email', css_class='col-sm-6 col-6'),
|
|
|
- css_class='form-row row'),
|
|
|
-
|
|
|
-
|
|
|
- Div(
|
|
|
- Div('gruendungsjahr', css_class='col-sm-6 col-6'),
|
|
|
- Div('betriebgenommen', css_class='col-sm-6 col-6'),
|
|
|
- css_class='form-row row'),
|
|
|
+ self.product_layout,
|
|
|
|
|
|
+ Fieldset(
|
|
|
+ 'Wohnprojekt',
|
|
|
'eigentum', 'inseratstext', 'altneu', 'schwerpunkt', 'wohnbaufoerderung', 'artmodell', 'bautraeger',
|
|
|
|
|
|
Div(
|
|
|
@@ -144,14 +150,15 @@ class SubmissionForm(forms.ModelForm):
|
|
|
|
|
|
'awohnungen',
|
|
|
|
|
|
- Div(
|
|
|
+ Fieldset ( 'FLächen',
|
|
|
+ Div(
|
|
|
Div('wohnflaeche', css_class='col-sm-3 col-3'),
|
|
|
Div('gewerbeflaechen', css_class='col-sm-3 col-3'),
|
|
|
Div('gemeinschaftsflaeche', css_class='col-sm-3 col-3'),
|
|
|
Div('sonstige_flaechen', css_class='col-sm-3 col-3'),
|
|
|
css_class='form-row row'),
|
|
|
- 'kflaechen',
|
|
|
-
|
|
|
+ 'kflaechen',
|
|
|
+ ),
|
|
|
Div(
|
|
|
Div('gemeinschaftr', css_class='col-sm-6 col-6'),
|
|
|
Div('raumangebot', css_class='col-sm-6 col-6'),
|
|
|
@@ -167,72 +174,6 @@ class SubmissionForm(forms.ModelForm):
|
|
|
|
|
|
|
|
|
|
|
|
-class CreditForm(forms.ModelForm):
|
|
|
- class Meta:
|
|
|
- model = Credit
|
|
|
- fields = ('owner','architecture','concept','structural_engeneering','facade_design',
|
|
|
- 'face_construction','kinetic_design','light_design','tecnical_layout',
|
|
|
- 'display_content','light_hardware','lightning_software','product_coordination',
|
|
|
- 'membrane_skin','interaction_design','sponsor','module_elems')
|
|
|
-
|
|
|
- def __init__(self, *args, **kwargs):
|
|
|
- super(CreditForm, self).__init__(*args, **kwargs)
|
|
|
-
|
|
|
- self.fields['owner'].help_text = ('<i>e.g. Cardinal Group</i>')
|
|
|
- self.fields['architecture'].help_text = ('<i>e.g. Domenico Torrone and Partners</i>')
|
|
|
- self.fields['concept'].help_text = ('<i>e.g. Domenico Torrone and Partners</i>')
|
|
|
- self.fields['structural_engeneering'].help_text = ('<i>e.g. Osap Inc., Hongkong</i>')
|
|
|
- self.fields['facade_design'].help_text = ('<i>e.g. Mega Facades Inc, Beijing</i>')
|
|
|
- self.fields['face_construction'].help_text = ('<i>e.g. None</i>')
|
|
|
- self.fields['kinetic_design'].help_text = ('<i>e.g. Domenico Torrone and Osap, Hongkong</i>')
|
|
|
- self.fields['light_design'].help_text = ('<i>e.g. Domenico Torrone and Osap, Hongkong</i>')
|
|
|
- self.fields['tecnical_layout'].help_text = ('<i>e.g. Modul Labs, Berlin</i>')
|
|
|
- self.fields['display_content'].help_text = ('<i>e.g. Domenico Torrone;reality check, Munich;</i>')
|
|
|
- self.fields['light_hardware'].help_text = ('<i>e.g. Modul Labs, Berlin</i>')
|
|
|
- self.fields['lightning_software'].help_text = ('<i>e.g. Dimma DMX by Eflux</i>')
|
|
|
- self.fields['product_coordination'].help_text = ('<i>e.g. Domenico Torrone and Partners</i>')
|
|
|
- self.fields['membrane_skin'].help_text = ('<i>e.g. none</i>')
|
|
|
- self.fields['interaction_design'].help_text = ('<i>e.g. pixeldings, Toronto</i>')
|
|
|
- self.fields['sponsor'].help_text = ('<i>e.g. none</i>')
|
|
|
- self.fields['module_elems'].help_text = ('<i>e.g. Maxi PIX 12 by Eflux</i>')
|
|
|
-
|
|
|
- self.fields['owner'].max_length = 100
|
|
|
- self.fields['architecture'].max_length = 100
|
|
|
- self.fields['concept'].max_length = 100
|
|
|
- self.fields['structural_engeneering'].max_length = 100
|
|
|
- self.fields['facade_design'].max_length = 100
|
|
|
- self.fields['face_construction'].max_length = 100
|
|
|
- self.fields['kinetic_design'].max_length = 100
|
|
|
- self.fields['light_design'].max_length = 100
|
|
|
- self.fields['tecnical_layout'].max_length = 100
|
|
|
- self.fields['display_content'].max_length = 100
|
|
|
- self.fields['light_hardware'].max_length = 100
|
|
|
- self.fields['lightning_software'].max_length = 100
|
|
|
- self.fields['product_coordination'].max_length = 100
|
|
|
- self.fields['membrane_skin'].max_length = 100
|
|
|
- self.fields['interaction_design'].max_length = 100
|
|
|
- self.fields['sponsor'].max_length = 100
|
|
|
- self.fields['module_elems'].max_length = 100
|
|
|
-
|
|
|
- self.helper = FormHelper()
|
|
|
- self.helper.field_class = 'form_border'
|
|
|
- self.helper.form_tag = False
|
|
|
- self.helper.layout = Layout(
|
|
|
- Fieldset(
|
|
|
- ('Credits'),
|
|
|
- Div( Div('owner',css_class='form-group col-md-5 mb-0'), Div('architecture',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('concept',css_class='form-group col-md-5 mb-0'), Div('structural_engeneering',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('facade_design',css_class='form-group col-md-5 mb-0'), Div('face_construction',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('kinetic_design',css_class='form-group col-md-5 mb-0'), Div('light_design',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('tecnical_layout',css_class='form-group col-md-5 mb-0'), Div('display_content',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('light_hardware',css_class='form-group col-md-5 mb-0'), Div('lightning_software',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('product_coordination',css_class='form-group col-md-5 mb-0'), Div('membrane_skin',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div('interaction_design',css_class='form-group col-md-5 mb-0'), Div('sponsor',css_class='form-group col-md-5 mb-0'), css_class='form-row'),
|
|
|
- Div( Div( 'module_elems',css_class='form-group col-md-5 mb-0'), css_class='form-row')
|
|
|
- ))
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
class DescriptionForm(forms.ModelForm):
|
|
|
class Meta:
|
|
|
@@ -341,32 +282,7 @@ class MediaForm(FileFormMixin, forms.Form):
|
|
|
))
|
|
|
|
|
|
|
|
|
- #def is_valid(self):
|
|
|
- # super(MediaForm,self).is_valid()
|
|
|
- # return True
|
|
|
-
|
|
|
-
|
|
|
- #def clean(self):
|
|
|
- # cleaned_data = super(MediaForm,self).clean()
|
|
|
-
|
|
|
- # #test for valid formats
|
|
|
- # #if cleaned_data['image']
|
|
|
- # # raise ValidationError('Title field is required')
|
|
|
- # return cleaned_data
|
|
|
-
|
|
|
-
|
|
|
- #def save(self, Product_pk):
|
|
|
- # self.clean()
|
|
|
- # media = Media()
|
|
|
- # print('hallo')
|
|
|
- # media.Product= Product_pk
|
|
|
- # media.image=self.cleaned_data['image']
|
|
|
- # media.name_for=self.cleaned_data['name_for']
|
|
|
- # media.copyright =self.cleaned_data['copyright']
|
|
|
- # media.Product= Product_pk
|
|
|
- # media.save()
|
|
|
|
|
|
- ## self.delete_temporary_files()
|
|
|
|
|
|
|
|
|
class MediaForm_test(FileFormMixin, forms.Form):
|