Révision 7ab17a37
Ajouté par Josué Kouka il y a plus de 8 ans
mandayejs/mandaye/forms.py | ||
---|---|---|
13 | 13 |
# |
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 |
from __future__ import absolute_import |
|
16 | 17 |
|
17 | 18 |
from django import forms |
19 |
from django.conf import settings |
|
18 | 20 |
|
21 |
from mandayejs.mandaye.models import UserCredentials |
|
19 | 22 |
|
20 | 23 |
class FormFactory(forms.Form): |
21 | 24 |
def __init__(self, *args, **kwargs): |
22 |
fields = kwargs.pop('locators', None) |
|
23 | 25 |
super(FormFactory, self).__init__(*args, **kwargs) |
24 |
|
|
26 |
fields = getattr(settings, 'SITE_LOCATORS', []) |
|
25 | 27 |
if fields : |
26 | 28 |
for field in fields : |
27 | 29 |
if field['kind'] == 'string': |
... | ... | |
42 | 44 |
help_text=field['help'] |
43 | 45 |
) |
44 | 46 |
|
45 |
def is_valid(self,): |
|
46 |
is_valid = super(FormFactory, self).is_valid() |
|
47 |
if not is_valid: |
|
48 |
return is_valid |
|
49 |
|
|
50 |
if self.data == {}: |
|
51 |
return False |
|
52 |
|
|
53 |
return is_valid |
|
54 |
|
Formats disponibles : Unified diff
handle user association the right way (#9527)