Beispiel #1
0
 def __init__(self, user, *args, **kwargs):
     super(DuplicateSMSCampaignForm, self).__init__(*args, **kwargs)
     self.fields["campaign_code"].initial = get_unique_code(length=5)
     for i in self.fields.keyOrder:
         self.fields[i].widget.attrs["class"] = "form-control"
     if user:
         self.fields["phonebook"].choices = get_phonebook_list(user)
Beispiel #2
0
    def __init__(self, user, *args, **kwargs):
        super(SMSCampaignForm, self).__init__(*args, **kwargs)
        self.fields["campaign_code"].initial = get_unique_code(length=5)
        exclude_list = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]

        for i in self.fields.keyOrder:
            if i not in exclude_list:
                self.fields[i].widget.attrs["class"] = "form-control"

        if user:
            self.fields["ds_user"].initial = user
            phonebook_list = get_phonebook_list(user)
            self.fields["phonebook"].choices = phonebook_list
            self.fields["phonebook"].initial = str(phonebook_list[0][0])
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     super(SMSCampaignAdminForm, self).__init__(*args, **kwargs)
     self.fields["campaign_code"].widget.attrs["readonly"] = True
     self.fields["campaign_code"].initial = get_unique_code(length=5)