Ejemplo n.º 1
0
def contact_form_listener(sender, object=None, formdata=None, form=None, **kwargs):
    if 'newsletter' not in formdata:
        subscribed = False
    else:
        subscribed = formdata['newsletter']
    
    log.debug('Updating newletter subscription for %s to %s', object, subscribed)
    update_subscription(object, subscribed)
Ejemplo n.º 2
0
def contact_form_listener(sender, object=None, formdata=None, form=None, **kwargs):
    if 'newsletter' not in formdata:
        email = formdata.get('email', None)
        if Subscription.email_is_subscribed(email):
                subscribed = True
        else:
                subscribed = False
    else:
        subscribed = formdata['newsletter']
    
    log.debug('Updating newletter subscription for %s to %s', object, subscribed)
    update_subscription(object, subscribed)
Ejemplo n.º 3
0
def contact_form_listener(sender,
                          object=None,
                          formdata=None,
                          form=None,
                          **kwargs):
    if 'newsletter' not in formdata:
        email = formdata.get('email', None)
        if Subscription.email_is_subscribed(email):
            subscribed = True
        else:
            subscribed = False
    else:
        subscribed = formdata['newsletter']

    log.debug('Updating newletter subscription for %s to %s', object,
              subscribed)
    update_subscription(object, subscribed)
Ejemplo n.º 4
0
 def save(self, state=_NOTSET, attributes={}):
     contact = self.get_contact()
     if state == _NOTSET:
         state = self.cleaned_data['subscribed']
     return update_subscription(contact, state, attributes=attributes)