|
@@ -1,22 +1,25 @@
|
|
|
from django import forms
|
|
from django import forms
|
|
|
|
|
|
|
|
from django.conf import settings
|
|
from django.conf import settings
|
|
|
-from .models import *
|
|
|
|
|
|
|
+from django.core.files import File
|
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
|
from django_file_form.forms import UploadedFileField, FileFormMixin, CharField, MultipleUploadedFileField
|
|
from django_file_form.forms import UploadedFileField, FileFormMixin, CharField, MultipleUploadedFileField
|
|
|
from django.contrib.auth.models import User
|
|
from django.contrib.auth.models import User
|
|
|
-from crispy_forms.helper import FormHelper
|
|
|
|
|
|
|
+from django.urls import reverse, reverse_lazy
|
|
|
|
|
+from django.forms import formset_factory
|
|
|
|
|
+from django.forms.widgets import HiddenInput
|
|
|
|
|
+from django.forms.models import inlineformset_factory
|
|
|
# from crispy_forms.layout.buttons import Submit, InputButton
|
|
# from crispy_forms.layout.buttons import Submit, InputButton
|
|
|
|
|
+
|
|
|
from crispy_forms.layout import Layout, Field, Fieldset, Div, Row, Column, HTML, ButtonHolder, Submit
|
|
from crispy_forms.layout import Layout, Field, Fieldset, Div, Row, Column, HTML, ButtonHolder, Submit
|
|
|
from crispy_forms.bootstrap import InlineField
|
|
from crispy_forms.bootstrap import InlineField
|
|
|
-from django.forms.models import inlineformset_factory
|
|
|
|
|
-from django.forms import formset_factory
|
|
|
|
|
-from django import forms
|
|
|
|
|
|
|
+from crispy_forms.helper import FormHelper
|
|
|
from captcha.fields import CaptchaField
|
|
from captcha.fields import CaptchaField
|
|
|
-from django.core.files import File
|
|
|
|
|
-from marktplatz.widgets import *
|
|
|
|
|
-from django.forms.widgets import HiddenInput
|
|
|
|
|
|
|
+from newsletter.forms import *
|
|
|
|
|
|
|
|
|
|
+from marktplatz.widgets import *
|
|
|
|
|
+from .models import *
|
|
|
|
|
+from .urls import *
|
|
|
|
|
|
|
|
def extend_help_text( help_text, myList ):
|
|
def extend_help_text( help_text, myList ):
|
|
|
extended_text = help_text
|
|
extended_text = help_text
|
|
@@ -55,19 +58,96 @@ class textSearchForm(forms.Form):
|
|
|
|
|
|
|
|
class searchAgentForm(forms.ModelForm):
|
|
class searchAgentForm(forms.ModelForm):
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = SearchAgent
|
|
model = SearchAgent
|
|
|
- fields = '__all__'
|
|
|
|
|
- # fields = ('first_name','last_name','adress','postcode','city','country', 'email','phonenumber','alternate_phonenumber','skype_name','website', 'terms')
|
|
|
|
|
|
|
+ fields = ('ort', 'email')
|
|
|
|
|
+
|
|
|
|
|
+ agent_layout = Layout(
|
|
|
|
|
+ Fieldset(
|
|
|
|
|
+ ('Suchagent'),
|
|
|
|
|
+ 'ort',
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+class AgentNewslwtterForm(forms.Form, searchAgentForm):
|
|
|
|
|
+
|
|
|
|
|
+ email_field = forms.EmailField( label = 'Email', required=True, max_length=254 )
|
|
|
|
|
+ subscribe = forms.BooleanField( label = 'Newsletter abonnieren', help_text='', required = False )
|
|
|
|
|
+ captcha = CaptchaField( label = 'Bitte lösen Sie die Gleichung', generator='captcha.helpers.math_challenge' )
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ # def clean(self):
|
|
|
|
|
+ # # Then call the clean() method of the super class
|
|
|
|
|
+ # cleaned_data = super(AgentNewslwtterForm, self).clean()
|
|
|
|
|
+ # cleaned_data['email'] = cleaned_data['email_field']
|
|
|
|
|
+ # return cleaned_data
|
|
|
|
|
+
|
|
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
|
|
+ super(searchAgentForm, self).__init__(*args, **kwargs)
|
|
|
|
|
+ self.helper = FormHelper(self)
|
|
|
|
|
+ self.helper.attrs = { 'enctype' : "multipart/form-data" }
|
|
|
|
|
+ self.helper.form_action = reverse('agent-newsletter-create', kwargs={'newsletter_slug': "test_news"} )
|
|
|
|
|
+
|
|
|
|
|
+ self.helper.layout = Layout(
|
|
|
|
|
+ self.agent_layout,
|
|
|
|
|
+ 'email_field',
|
|
|
|
|
+ 'subscribe',
|
|
|
|
|
+ 'captcha',
|
|
|
|
|
+ ButtonHolder(
|
|
|
|
|
+ Submit('submit', 'Anmelden', css_class='border-thin border-dark mybtn')
|
|
|
|
|
+ ),
|
|
|
|
|
+ # Submit('submit', 'Submit', css_class='btn border-dark rounded-0 mybtn'),
|
|
|
|
|
+
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+# class MarktSubscribeRequestForm(SubscribeRequestForm, searchAgentForm):
|
|
|
|
|
+# """
|
|
|
|
|
+# Request subscription to the newsletter. Will result in an activation email
|
|
|
|
|
+# being sent with a link where one can edit, confirm and activate one's
|
|
|
|
|
+# subscription.
|
|
|
|
|
+# """
|
|
|
|
|
+#
|
|
|
|
|
+# newsletter = Newsletter.objects.get(title="Test")
|
|
|
|
|
+# subscribeForm = SubscribeRequestForm(request.POST or None, newsletter=newsletter)
|
|
|
|
|
+#
|
|
|
|
|
+# def __init__(self, *args, **kwargs):
|
|
|
|
|
+# super(MarktSubscribeRequestForm, self).__init__(*args, **kwargs)
|
|
|
|
|
+# self.helper = FormHelper()
|
|
|
|
|
+# # self.helper.form_tag = False
|
|
|
|
|
+# self.helper.layout = Layout(
|
|
|
|
|
+# self.agent_layout,
|
|
|
|
|
+# 'email_field',
|
|
|
|
|
+#
|
|
|
|
|
+# # Submit('submit', 'Submit', css_class='btn border-dark rounded-0 mybtn'),
|
|
|
|
|
+#
|
|
|
|
|
+# )
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class RegisterForm(forms.ModelForm):
|
|
class RegisterForm(forms.ModelForm):
|
|
|
- terms = forms.BooleanField(required=True, label= ('I accept and have read the <a href="https://www.mediaarchitecture.org/privacy-policy/">Privacy Policy.</a>'))
|
|
|
|
|
|
|
+ drurl = reverse_lazy( 'pages-generic', kwargs= { 'page': 'DATENSCHUTZRICHTLINIE' } )
|
|
|
|
|
+ terms = forms.BooleanField(required=True, label= ('Ich akzeptiere die <a href="{}"> Datenschutzrichtlinie und habe sie gelesen.</a>' ) )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Contact
|
|
model = Contact
|
|
|
fields = ('first_name','last_name','adress','postcode','city','country',
|
|
fields = ('first_name','last_name','adress','postcode','city','country',
|
|
|
'email','phonenumber','alternate_phonenumber','skype_name','website', 'terms')
|
|
'email','phonenumber','alternate_phonenumber','skype_name','website', 'terms')
|
|
|
|
|
|
|
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
|
|
+ super(RegisterForm, self).__init__(*args, **kwargs)
|
|
|
|
|
+ drurl = reverse_lazy( 'pages-generic', kwargs= { 'page': 'DATENSCHUTZRICHTLINIE' } )
|
|
|
|
|
+ tmurl = reverse_lazy( 'pages-generic', kwargs= { 'page': 'TEILNAHME' } )
|
|
|
|
|
+ self.fields ['terms'].label = 'Ich akzeptiere die <a href="{}"> Datenschutzrichtlinie</a> sowie die <a href="{}"> Teilnahmebedingungen</a> und habe sie gelesen.'.format(drurl, tmurl)
|
|
|
|
|
+
|
|
|
class SignUpForm(UserCreationForm):
|
|
class SignUpForm(UserCreationForm):
|
|
|
captcha = CaptchaField( generator='captcha.helpers.math_challenge' )
|
|
captcha = CaptchaField( generator='captcha.helpers.math_challenge' )
|
|
|
|
|
|
|
@@ -176,7 +256,7 @@ class WohnprojektForm(ProductForm):
|
|
|
|
|
|
|
|
'awohnungen',
|
|
'awohnungen',
|
|
|
|
|
|
|
|
- Fieldset ( 'FLächen',
|
|
|
|
|
|
|
+ Fieldset ( 'Flächen',
|
|
|
Div(
|
|
Div(
|
|
|
Div('wohnflaeche', css_class='col-sm-3 col-3'),
|
|
Div('wohnflaeche', css_class='col-sm-3 col-3'),
|
|
|
Div('gewerbeflaechen', css_class='col-sm-3 col-3'),
|
|
Div('gewerbeflaechen', css_class='col-sm-3 col-3'),
|