|
@@ -2,6 +2,8 @@ from django import forms
|
|
|
|
|
|
from .models import Contrib
|
|
|
|
|
|
+import re
|
|
|
+
|
|
|
|
|
|
ORIENTATIONS = (
|
|
|
('N', 'Nord'),
|
|
@@ -72,11 +74,18 @@ class PublicContribForm(forms.ModelForm):
|
|
|
if data.get('access_type') == '':
|
|
|
self.add_error('access_type', 'Ce champ est requis')
|
|
|
|
|
|
+ #tetaneutral.net: comment with link to photos required for new connection request
|
|
|
+ def _validate_comment(self, data):
|
|
|
+ if data.get('contrib_type') == Contrib.CONTRIB_CONNECT and re.search('https?://', data.get('comment')) is None:
|
|
|
+ self.add_error('comment', 'Un lien vers les photos doit être fourni')
|
|
|
+
|
|
|
def clean(self):
|
|
|
cleaned_data = super().clean()
|
|
|
self._validate_contact_information(cleaned_data)
|
|
|
self._validate_floors(cleaned_data)
|
|
|
self._validate_share_fields(cleaned_data)
|
|
|
+ #tetaneutral.net: comment with link to photos required for new connection request
|
|
|
+ self._validate_comment(cleaned_data)
|
|
|
return cleaned_data
|
|
|
|
|
|
def privacy_fields(self):
|