Make client groups optional
This commit is contained in:
parent
7a1259a565
commit
68c0488462
1 changed files with 4 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
from django.forms import ModelForm, CharField, BooleanField, ImageField, ModelChoiceField, ModelMultipleChoiceField, BooleanField
|
from django.forms import ModelForm, CharField, BooleanField, ImageField, ModelChoiceField, ModelMultipleChoiceField, BooleanField, ValidationError
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
@ -45,7 +45,7 @@ class ClientEditForm(ModelForm):
|
||||||
company_id = CharField(label=_('Company Registration Number'), required=False)
|
company_id = CharField(label=_('Company Registration Number'), required=False)
|
||||||
default_currency = ModelChoiceField(Currency.objects.all(), label=_("Default Currency"))
|
default_currency = ModelChoiceField(Currency.objects.all(), label=_("Default Currency"))
|
||||||
brands = ModelMultipleChoiceField(Brand.objects.all(), label=_("Associated Brands"))
|
brands = ModelMultipleChoiceField(Brand.objects.all(), label=_("Associated Brands"))
|
||||||
client_groups = ModelMultipleChoiceField(ClientGroup.objects.all(), label=_("Client Groups"))
|
client_groups = ModelMultipleChoiceField(ClientGroup.objects.all(), label=_("Client Groups"), required=False)
|
||||||
marketing_opt_in = BooleanField(label=_("Opted in to marketing messages"), required=False)
|
marketing_opt_in = BooleanField(label=_("Opted in to marketing messages"), required=False)
|
||||||
pgp_key = CharField(label=_("GPG encryption key"), required=False)
|
pgp_key = CharField(label=_("GPG encryption key"), required=False)
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ class ClientCreateForm(ModelForm):
|
||||||
company_id = CharField(label=_('Company Registration Number'), required=False)
|
company_id = CharField(label=_('Company Registration Number'), required=False)
|
||||||
default_currency = ModelChoiceField(Currency.objects.all(), label=_("Default Currency"))
|
default_currency = ModelChoiceField(Currency.objects.all(), label=_("Default Currency"))
|
||||||
brands = ModelMultipleChoiceField(Brand.objects.all(), label=_("Associated Brands"))
|
brands = ModelMultipleChoiceField(Brand.objects.all(), label=_("Associated Brands"))
|
||||||
client_groups = ModelMultipleChoiceField(ClientGroup.objects.all(), label=_("Client Groups"))
|
client_groups = ModelMultipleChoiceField(ClientGroup.objects.all(), label=_("Client Groups"), required=False)
|
||||||
marketing_opt_in = BooleanField(label=_("Opted in to marketing messages"), required=False)
|
marketing_opt_in = BooleanField(label=_("Opted in to marketing messages"), required=False)
|
||||||
pgp_key = CharField(label=_("GPG encryption key"), required=False)
|
pgp_key = CharField(label=_("GPG encryption key"), required=False)
|
||||||
send_password = BooleanField(label=_("Send password reset email now?"), required=False)
|
send_password = BooleanField(label=_("Send password reset email now?"), required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = get_user_model()
|
model = get_user_model()
|
||||||
fields = ('first_name', 'last_name', "company", "email", 'mobile', 'address1', 'address2', 'zip', 'city', 'state', 'country', 'vat_id', 'company_id', 'default_currency', 'brands', 'client_groups', 'marketing_opt_in', 'pgp_key', 'send_password')
|
fields = ('first_name', 'last_name', "company", "email", 'mobile', 'address1', 'address2', 'zip', 'city', 'state', 'country', 'vat_id', 'company_id', 'default_currency', 'brands', 'client_groups', 'marketing_opt_in', 'pgp_key', 'send_password')
|
||||||
|
|
Loading…
Reference in a new issue