+# -*- coding: utf-8 -*-
+#
+# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from django import forms
from .models import Organization, UserCard, countries
+
class OrganizationForm(forms.ModelForm):
cts = countries
model = Organization
exclude = ['_html']
+
class UserCardForm(forms.ModelForm):
cts = countries
'first_name': kwargs['instance'].user.first_name,
'last_name': kwargs['instance'].user.last_name,
}
- return super(UserCardForm, self).__init__(*args, **kwargs)
+ super(UserCardForm, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
self.instance.user.first_name = self.cleaned_data.get('first_name', '')
self.instance.user.last_name = self.cleaned_data.get('last_name', '')
self.instance.user.save()
return super(UserCardForm, self).save(*args, **kwargs)
-