You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when passing a standard Python list I get errors like this:
'list' object is not callable` error in `campaign/forms.py, line 35, in clean
…
if custom_list: # Check if the defined module does exist and can be initialized, if not throw a hard exception instead of only adding an error
import_string(custom_list)()
It seems a Python list isn't intended here for custom_list? Could you give a working example of how it should perform?
For example, I would like to pass in simply a list of email addresses, unconnected to a user model.
The text was updated successfully, but these errors were encountered:
In this case the CustomRecipientList would be something like this:
class CustomRecipient(object):
# wrapper class around email addresses ... used below in object_list method
def __init__(self, emailaddress):
self.email = emailaddress # enter 'email' in email_field_name of the SubscriberList object
class CustomRecipientList(object):
# dotted path to this class is configured in settings.CAMPAIGN_CUSTOM_SUBSCRIBER_LISTS
recipients = ["[email protected]", "[email protected]"] # this is your simple list of addresses - only line you need to change - if it's dynamic at runtime add the code to the object_list method below
def object_count(self):
return len(self.recipients)
def object_list(self):
return [CustomRecipient(email) for email in self.recipients]
Thanks for a cool project.
The code shows a
custom_list
field as choices fromCAMPAIGN_CUSTOM_SUBSCRIBER_LISTS
on theSubscriberList
model:https://github.com/arneb/django-.campaign/blob/a861c8cb7384b00c30c84600e3f523e624a02dae/campaign/models.py#L67C1-L68C1
However, when passing a standard Python list I get errors like this:
It seems a Python list isn't intended here for
custom_list
? Could you give a working example of how it should perform?For example, I would like to pass in simply a list of email addresses, unconnected to a user model.
The text was updated successfully, but these errors were encountered: