当前位置: 首页>>代码示例>>Python>>正文


Python ModuleSetting.get_for_module方法代码示例

本文整理汇总了Python中treeio.core.models.ModuleSetting.get_for_module方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleSetting.get_for_module方法的具体用法?Python ModuleSetting.get_for_module怎么用?Python ModuleSetting.get_for_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在treeio.core.models.ModuleSetting的用法示例。


在下文中一共展示了ModuleSetting.get_for_module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
    def __init__(self, user, *args, **kwargs):
        "Sets choices and initial value"
        super(SettingsForm, self).__init__(*args, **kwargs)
        
        self.fields['my_company'].queryset = Object.filter_permitted(user, Contact.objects)
        self.fields['my_company'].widget.attrs.update({'class': 'autocomplete', 
                                                       'callback': reverse('identities_ajax_contact_lookup')})
        self.fields['default_account'].queryset = Object.filter_permitted(user, Account.objects)

        # Translation
        self.fields['default_currency'].label=_('Base Currency')
        self.fields['my_company'].label=_('My Company')
        self.fields['default_account'].label=_('Default Account')

        try:
            self.fields['default_currency'].widget.attrs.update({'popuplink': reverse('finance_currency_add')})
            self.fields['default_currency'].queryset = Currency.objects.all()
            self.fields['default_currency'].initial = Currency.objects.get(is_default=True)
        except Exception:
            pass
        
        try:
            conf = ModuleSetting.get_for_module('treeio.finance', 'my_company')[0]
            my_company = Contact.objects.get(pk=long(conf.value))
            self.fields['my_company'].initial = my_company.id
        except Exception:
            pass

        try:
            conf = ModuleSetting.get_for_module('treeio.finance', 'default_account')[0]
            default_account = Account.objects.get(pk=long(conf.value))
            self.fields['default_account'].initial = default_account.id
        except Exception:
            pass
开发者ID:3atmospheres,项目名称:treeio,代码行数:36,代码来源:forms.py

示例2: save

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module(
                "default_perspective", self.cleaned_data["default_perspective"].id, "treeio.core"
            )
            ModuleSetting.set_for_module("default_permissions", self.cleaned_data["default_permissions"], "treeio.core")
            ModuleSetting.set_for_module("default_timezone", self.cleaned_data["default_timezone"], "treeio.core")
            ModuleSetting.set_for_module("language", self.cleaned_data["language"], "treeio.core")
            if getattr(settings, "HARDTREE_SUBSCRIPTION_CUSTOMIZATION", True):
                if isinstance(self.fields["logo"], forms.FileField):
                    logopath = self._handle_uploaded_file("logo")
                    ModuleSetting.set_for_module("logopath", logopath, "treeio.core")

                elif isinstance(self.fields["logo"], forms.ChoiceField):
                    if self.cleaned_data["logo"] == "delete":
                        try:
                            ModuleSetting.get_for_module("treeio.core", "logopath").delete()
                        except:
                            pass

            return True

        except:
            return False
开发者ID:nrazon,项目名称:treeio,代码行数:27,代码来源:forms.py

示例3: save

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_perspective',
                                         self.cleaned_data['default_perspective'].id,
                                         'treeio.core')
            ModuleSetting.set_for_module('default_permissions',
                                         self.cleaned_data['default_permissions'],
                                         'treeio.core')
            ModuleSetting.set_for_module('default_timezone',
                                         self.cleaned_data['default_timezone'],
                                         'treeio.core')
            ModuleSetting.set_for_module('language',
                                         self.cleaned_data['language'],
                                         'treeio.core')
            if getattr(settings, 'HARDTREE_SUBSCRIPTION_CUSTOMIZATION', True):
                if isinstance(self.fields['logo'], forms.FileField):
                    logopath = self._handle_uploaded_file('logo')
                    ModuleSetting.set_for_module('logopath', logopath, 'treeio.core')
                    
                elif isinstance(self.fields['logo'], forms.ChoiceField):
                    if self.cleaned_data['logo'] == 'delete':
                        try:
                            ModuleSetting.get_for_module('treeio.core', 'logopath').delete()
                        except:
                            pass
            
            return True

        except:
            return False
开发者ID:matalaniz,项目名称:treeio,代码行数:33,代码来源:forms.py

示例4: __init__

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
 def __init__(self, user, *args, **kwargs):
     "Sets choices and initial value"
     super(SettingsForm, self).__init__(*args, **kwargs)
     self.user = user
     
     self.fields['default_contact_type'].label = _('Default Contact Type')
     self.fields['default_contact_type'].queryset = Object.filter_permitted(user, 
                                                                            ContactType.objects, mode='x')
     try:
         conf = ModuleSetting.get_for_module('treeio.messaging', 'default_contact_type',
                                             user=user)[0]
         default_contact_type = ContactType.objects.get(pk=long(conf.value))
         self.fields['default_contact_type'].initial = default_contact_type.id
     except:
         pass
     
     
     self.fields['default_imap_folder'].label = _('Default IMAP Folder')
     try:
         conf = ModuleSetting.get_for_module('treeio.messaging', 'default_imap_folder',
                                             user=user)[0]
         self.fields['default_imap_folder'].initial = conf.value
     except:
         self.fields['default_imap_folder'].initial = settings.HARDTREE_MESSAGING_IMAP_DEFAULT_FOLDER_NAME
     
     
     self.fields['signature'].label = _('Signature')
     try:
         conf = ModuleSetting.get_for_module('treeio.messaging', 'signature',
                                             user=user, strict=True)[0]
         signature = conf.value
         self.fields['signature'].initial = signature
     except:
         pass
开发者ID:jmfield2,项目名称:treeio,代码行数:36,代码来源:forms.py

示例5: email_caller_on_new_ticket

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def email_caller_on_new_ticket(sender, instance, created, **kwargs):
    "When a new ticket is created send an email to the caller"
    if created:
        send_email_to_caller = False
        try:
            conf = ModuleSetting.get_for_module("treeio.services", "send_email_to_caller")[0]
            send_email_to_caller = conf.value
        except:
            send_email_to_caller = getattr(settings, "HARDTREE_SEND_EMAIL_TO_CALLER", True)

        if send_email_to_caller:
            # don't send email to yourself
            creator_contact = None
            if instance.creator:
                creator_contact = instance.creator.get_contact()

            if instance.caller and instance.caller != creator_contact:
                if not instance.reference:
                    if instance.queue:
                        instance.reference = instance.queue.ticket_code + str(instance.id)
                    else:
                        instance.reference = str(instance.id)
                    instance.save()
                subject = "[#%s] %s" % (instance.reference, instance.name)

                # Construct context and render to html, body
                context = {"ticket": instance}
                try:
                    conf = ModuleSetting.get_for_module("treeio.services", "send_email_template")[0]
                    send_email_template = conf.value
                    html = render_string_template(send_email_template, context)
                except Exception, e:
                    html = render_to_string("services/emails/notify_caller", context, response_format="html")
                body = strip_tags(html)

                if instance.queue and instance.queue.message_stream:
                    stream = instance.queue.message_stream
                    if stream.outgoing_server_name:
                        try:
                            caller_email = instance.caller.get_email()
                            if caller_email:
                                toaddr = caller_email
                                ssl = False
                                if stream.outgoing_server_type == "SMTP-SSL":
                                    ssl = True
                                email = BaseEmail(
                                    stream.outgoing_server_name,
                                    stream.outgoing_server_username,
                                    stream.outgoing_password,
                                    stream.outgoing_email,
                                    toaddr,
                                    subject,
                                    body,
                                    html=html,
                                    ssl=ssl,
                                )
                                email.process_email()
                        except:
                            pass
开发者ID:nrazon,项目名称:treeio,代码行数:61,代码来源:models.py

示例6: create_ticket_from_message

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def create_ticket_from_message(sender, instance, created, **kwargs):
    """
    Get a signal from messaging.models
    Check if (new) message's stream is also assigned to Ticket Queue
    Create a new ticket from that message
    Rename original message title
    """
    
    if created and getattr(instance, 'auto_notify', True):
        if instance.reply_to:
            tickets = instance.reply_to.ticket_set.all()
            for ticket in tickets:
                record = TicketRecord()
                record.sender = instance.author
                record.record_type = 'manual'
                record.body = instance.body
                record.save()
                record.about.add(ticket)
                ticket.set_last_updated()
                try:
                    conf = ModuleSetting.get_for_module('treeio.services', 'default_ticket_status')[0]
                    ticket.status = TicketStatus.objects.get(pk=long(conf.value))
                except:
                    statuses = TicketStatus.objects.all()
                    ticket.status = statuses[0]
                ticket.save()
        else:
            stream = instance.stream
            queues = TicketQueue.objects.filter(message_stream=stream)
            if stream and queues:
                queue = queues[0]
                ticket = Ticket()
                try:
                    conf = ModuleSetting.get_for_module('treeio.services', 'default_ticket_status')[0]
                    ticket.status = TicketStatus.objects.get(pk=long(conf.value))
                except:
                    statuses = TicketStatus.objects.all()
                    ticket.status = statuses[0]
                ticket.queue = queue
                ticket.caller = instance.author
                ticket.details = instance.body
                ticket.message = instance
                ticket.name = instance.title
                ticket.auto_notify = False
                ticket.save()
                try:
                    if stream.creator:
                        ticket.set_user(stream.creator)
                    elif queue.creator:
                        ticket.set_user(queue.creator)
                    else:
                        ticket.copy_permissions(queue)
                except:
                    pass
                
                # Rename original message title
                instance.title = "[#" + ticket.reference + "] " + instance.title
                instance.save()
开发者ID:pascalmouret,项目名称:treeio,代码行数:60,代码来源:models.py

示例7: __init__

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
    def __init__(self, user, lead, *args, **kwargs):
        super(OpportunityForm, self).__init__(*args, **kwargs)
              
        self.fields['lead'].queryset = Object.filter_permitted(user, Lead.objects)
        self.fields['contact'].queryset = Object.filter_permitted(user, Contact.objects)
        self.fields['contact'].widget.attrs.update({'popuplink': reverse('identities_contact_add')})
        self.fields['contact'].widget.attrs.update({'class': 'autocomplete', 
                                                    'callback': reverse('identities_ajax_contact_lookup')})
        self.fields['products_interested'].queryset = Object.filter_permitted(user, Product.objects)
        self.fields['products_interested'].widget.attrs.update({'popuplink': reverse('sales_product_add')})
        try:
            conf = ModuleSetting.get_for_module('treeio.sales', 'default_order_product')[0]
            self.fields['products_interested'].initial = [long(conf.value)]
        except:
            pass 
        self.fields['source'].queryset = Object.filter_permitted(user, 
                                                                 SaleSource.objects.filter(active=True))
        self.fields['status'].queryset = Object.filter_permitted(user, 
                                                        SaleStatus.objects.filter(use_opportunities=True))
        self.fields['assigned'].widget.attrs.update({'class': 'multicomplete', 
                                                     'callback': reverse('identities_ajax_user_lookup')})
        
        try:
            conf = ModuleSetting.get_for_module('treeio.sales', 'default_opportunity_status')[0]
            self.fields['status'].initial = long(conf.value)
        except:
            pass 
        
        if lead:
            self.fields['lead'].initial = lead.id
            self.fields['contact'].initial = lead.contact_id
            self.fields['products_interested'].initial = [i.id for i in lead.products_interested.only('id')]
            self.fields['source'].initial = lead.source_id
            self.fields['assigned'].initial = [i.id for i in lead.assigned.only('id')]
        else:
            del self.fields['lead']
        
        self.fields['products_interested'].help_text = ""
        self.fields['assigned'].help_text = ""
        
        self.fields['expected_date'].widget.attrs.update({'class': 'datepicker'})
        self.fields['closed_date'].widget.attrs.update({'class': 'datepicker'})

        self.fields['contact'].label = _("Contact")
        self.fields['products_interested'].label = _("Products interested")
        self.fields['source'].label = _("Source")
        self.fields['expected_date'].label = _("Expected date")
        self.fields['closed_date'].label = _("Closed date")
        self.fields['assigned'].label = _("Assigned to")
        self.fields['amount_display'].label = _("Amount")
        self.fields['amount_currency'].label = _("Currency")
        self.fields['amount_currency'].widget.attrs.update({'popuplink': reverse('finance_currency_add')})
        self.fields['amount_currency'].initial = Currency.objects.get(is_default=True)
        
        self.fields['probability'].label = _("Probability")
        self.fields['status'].label = _("Status")
        self.fields['details'].label = _("Details")
开发者ID:MechanisM,项目名称:treeio,代码行数:59,代码来源:forms.py

示例8: __init__

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
    def __init__(self, user, *args, **kwargs):
        "Sets choices and initial value"
        super(SettingsForm, self).__init__(*args, **kwargs)

        # Translate
        self.fields['default_ticket_status'].label = _('Default Ticket Status')
        self.fields['default_ticket_queue'].label = _('Default Queue')
        self.fields['send_email_to_caller'].label = _(
            "Notify Caller By E-mail")
        self.fields['send_email_template'].label = _("E-mail Template")

        self.fields['default_ticket_status'].queryset = Object.filter_permitted(
            user, TicketStatus.objects, mode='x')
        self.fields['default_ticket_queue'].queryset = Object.filter_permitted(
            user, TicketQueue.objects, mode='x')

        try:
            conf = ModuleSetting.get_for_module(
                'treeio.services', 'default_ticket_status')[0]
            default_ticket_status = TicketStatus.objects.get(
                pk=long(conf.value))
            self.fields[
                'default_ticket_status'].initial = default_ticket_status.id
        except Exception:
            pass

        try:
            conf = ModuleSetting.get_for_module(
                'treeio.services', 'default_ticket_queue')[0]
            default_ticket_queue = TicketQueue.objects.get(pk=long(conf.value))
            self.fields[
                'default_ticket_queue'].initial = default_ticket_queue.id
        except Exception:
            pass

        try:
            conf = ModuleSetting.get_for_module(
                'treeio.services', 'send_email_to_caller')[0]
            self.fields['send_email_to_caller'].initial = conf.value
        except:
            self.fields[
                'send_email_to_caller'].initial = settings.HARDTREE_SEND_EMAIL_TO_CALLER

        # notification template
        try:
            conf = ModuleSetting.get_for_module(
                'treeio.services', 'send_email_template')[0]
            self.fields['send_email_template'].initial = conf.value
        except Exception:
            self.fields['send_email_template'].initial = get_template_source(
                'services/emails/notify_caller.html')
开发者ID:AlexLX2,项目名称:treeio,代码行数:53,代码来源:forms.py

示例9: core_logo_content

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def core_logo_content(context, gif=False):
    "Return current logo encoded as base64"

    staticpath = getattr(settings, "STATIC_DOC_ROOT", "./static")
    logopath = staticpath + "/logo"
    if gif:
        logopath += ".gif"
        mimetype = "image/gif"
    else:
        logopath += ".png"
        mimetype = "image/png"

    customlogo = ""
    try:
        conf = ModuleSetting.get_for_module("treeio.core", "logopath")[0]
        customlogo = getattr(settings, "MEDIA_ROOT", "./static/media") + conf.value
    except:
        pass

    logofile = ""
    if customlogo:
        try:
            logofile = open(customlogo, "r")
        except:
            pass

    if not logofile:
        try:
            logofile = open(logopath, "r")
        except:
            pass

    result = "data:" + mimetype + ";base64," + base64.b64encode(logofile.read())

    return Markup(result)
开发者ID:nardus64,项目名称:treeio,代码行数:37,代码来源:modules.py

示例10: logo_image

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def logo_image(request, gif=False, response_format='html'):
    "Return current logo image"
    
    staticpath = getattr(settings, 'STATIC_DOC_ROOT', './static')
    logopath = staticpath + '/logo'
    if gif:
        logopath += '.gif'
        mimetype = 'image/gif'
    else:
        logopath += '.png'
        mimetype = 'image/png'
    
    customlogo = ''
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'logopath')[0]
        customlogo = getattr(settings, 'MEDIA_ROOT', './static/media') + conf.value
    except:
        pass
    
    logofile = ''
    if customlogo:
        try:
            logofile = open(customlogo, 'rb')
        except:
            pass
    
    if not logofile:
        try:
            logofile = open(logopath, 'rb')
        except:
            pass
    
    return HttpResponse(logofile.read(), mimetype=mimetype)
开发者ID:3atmospheres,项目名称:treeio,代码行数:35,代码来源:views.py

示例11: __init__

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
    def __init__(self, *args, **kwargs):

        self.user = kwargs.pop('user', None)
        super(UpdateRecordForm, self).__init__(*args, **kwargs)

        self.fields['body'].required = True
        self.fields['body'].label = _("Details")

        self.fields['recipients'].help_text = ""
        self.fields['recipients'].required = False
        self.fields['recipients'].widget.attrs.update({'class': 'multicomplete',
                                                       'callback': reverse('identities_ajax_access_lookup')})

        # get default permissions from settings
        try:
            conf = ModuleSetting.get_for_module(
                'treeio.core', 'default_permissions')[0]
            default_permissions = conf.value
        except:
            default_permissions = settings.HARDTREE_DEFAULT_PERMISSIONS

        if self.user and 'userallgroups' in default_permissions:
            self.fields['recipients'].initial = [
                i.id for i in self.user.other_groups.all().only('id')]
            self.fields['recipients'].initial.append(
                self.user.default_group.id)
        elif self.user and 'usergroup' in default_permissions:
            self.fields['recipients'].initial = [self.user.default_group.id]
开发者ID:5n1p,项目名称:treeio,代码行数:30,代码来源:forms.py

示例12: invoice

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
 def invoice(self):
     "Create a new sale order for self"
     new_invoice = SaleOrder()
     try:
         conf = ModuleSetting.get_for_module(
             'treeio.sales', 'default_order_status')[0]
         new_invoice.status = long(conf.value)
     except Exception:
         ss = SaleStatus.objects.all()[0]
         new_invoice.status = ss
     so = SaleSource.objects.all()[0]
     new_invoice.source = so
     new_invoice.client = self.client
     new_invoice.reference = "Subscription Invoice " + \
         str(datetime.today().strftime('%Y-%m-%d'))
     new_invoice.save()
     try:
         op = self.orderedproduct_set.filter(
             trash=False).order_by('-date_created')[0]
         opn = OrderedProduct()
         opn.order = new_invoice
         opn.product = self.product
         opn.quantity = op.quantity
         opn.discount = op.discount
         opn.subscription = self
         opn.save()
     except IndexError:
         opn = OrderedProduct()
         opn.order = new_invoice
         opn.product = self.product
         opn.quantity = 1
         opn.subscription = self
         opn.save()
     return new_invoice.reference
开发者ID:AlexLX2,项目名称:treeio,代码行数:36,代码来源:models.py

示例13: settings_view

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def settings_view(request, response_format='html'):
    "Settings"

    if not request.user.get_profile().is_admin('treeio.infrastructure'):
        return user_denied(request, message="You are not an Administrator of the Infrastructure module",
                           response_format=response_format)

    item_types = ItemType.objects.all().filter(trash=False)
    item_statuses = ItemStatus.objects.all().filter(trash=False)
    item_fields = ItemField.objects.all().filter(trash=False)

    default_item_status = None
    try:
        conf = ModuleSetting.get_for_module(
            'treeio.infrastructure', 'default_item_status')[0]
        default_item_status = ItemStatus.objects.get(
            pk=long(conf.value), trash=False)
    except Exception:
        pass

    context = _get_default_context(request)
    context.update({'item_types': item_types,
                    'item_fields': item_fields,
                    'item_statuses': item_statuses,
                    'default_item_status': default_item_status})

    return render_to_response('infrastructure/settings_view', context,
                              context_instance=RequestContext(request), response_format=response_format)
开发者ID:5n1p,项目名称:treeio,代码行数:30,代码来源:views.py

示例14: core_logo_content

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def core_logo_content(context, gif=False):
    "Return current logo encoded as base64"
    
    staticpath = getattr(settings, 'STATIC_DOC_ROOT', './static')
    logopath = staticpath + '/logo'
    if gif:
        logopath += '.gif'
        mimetype = 'image/gif'
    else:
        logopath += '.png'
        mimetype = 'image/png'
    
    customlogo = ''
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'logopath')[0]
        customlogo = getattr(settings, 'MEDIA_ROOT', './static/media') + conf.value
    except:
        pass
    
    logofile = ''
    if customlogo:
        try:
            logofile = open(customlogo, 'r')
        except:
            pass
    
    if not logofile:
        try:
            logofile = open(logopath, 'r')
        except:
            pass
    
    result = "data:" + mimetype + ";base64," + base64.b64encode(logofile.read())
    
    return Markup(result)
开发者ID:appost,项目名称:treeio,代码行数:37,代码来源:modules.py

示例15: messaging_compose

# 需要导入模块: from treeio.core.models import ModuleSetting [as 别名]
# 或者: from treeio.core.models.ModuleSetting import get_for_module [as 别名]
def messaging_compose(request, response_format='html'):
    "New message page"

    user = request.user.get_profile()

    if request.POST:
        if not 'cancel' in request.POST:
            message = Message()
            message.author = user.get_contact()
            if not message.author:
                return user_denied(request,
                                   message="You can't send message without a Contact Card assigned to you.",
                                   response_format=response_format)

            form = MessageForm(
                request.user.get_profile(), None, None, request.POST, instance=message)
            if form.is_valid():
                message = form.save()
                message.recipients.add(user.get_contact())
                message.set_user_from_request(request)
                message.read_by.add(user)
                try:
                    # if email entered create contact and add to recipients
                    if 'multicomplete_recipients' in request.POST and request.POST['multicomplete_recipients']:
                        try:
                            conf = ModuleSetting.get_for_module(
                                'treeio.messaging', 'default_contact_type')[0]
                            default_contact_type = ContactType.objects.get(
                                pk=long(conf.value))
                        except Exception:
                            default_contact_type = None
                        emails = request.POST[
                            'multicomplete_recipients'].split(',')
                        for email in emails:
                            emailstr = unicode(email).strip()
                            if re.match('[a-zA-Z0-9+_\-\.][email protected][0-9a-zA-Z][.-0-9a-zA-Z]*.[a-zA-Z]+', emailstr):
                                contact, created = Contact.get_or_create_by_email(
                                    emailstr, contact_type=default_contact_type)
                                message.recipients.add(contact)
                                if created:
                                    contact.set_user_from_request(request)
                except:
                    pass
                # send email to all recipients
                message.send_email()

                return HttpResponseRedirect(reverse('messaging'))
        else:
            return HttpResponseRedirect(reverse('messaging'))

    else:
        form = MessageForm(request.user.get_profile(), None)

    context = _get_default_context(request)
    context.update({'form': form})

    return render_to_response('messaging/message_compose', context,
                              context_instance=RequestContext(request), response_format=response_format)
开发者ID:5n1p,项目名称:treeio,代码行数:60,代码来源:views.py


注:本文中的treeio.core.models.ModuleSetting.get_for_module方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。