mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
@@ -28,7 +28,7 @@ class ForwardForm(forms.Form):
|
||||
recipients = []
|
||||
rawdata = self.cleaned_data["dest"].strip()
|
||||
if not rawdata:
|
||||
return
|
||||
return recipients
|
||||
for rcpt in rawdata.split(","):
|
||||
local_part, domname = split_mailbox(rcpt)
|
||||
if not local_part or not domname:
|
||||
|
||||
@@ -22,8 +22,8 @@ class DomainManager(Manager):
|
||||
to fill ``ModelChoiceField`` objects.
|
||||
"""
|
||||
if admin.is_superuser:
|
||||
return self.get_query_set()
|
||||
return self.get_query_set().filter(owners__user=admin)
|
||||
return self.get_queryset()
|
||||
return self.get_queryset().filter(owners__user=admin)
|
||||
|
||||
|
||||
class Domain(AdminObject):
|
||||
|
||||
@@ -66,7 +66,7 @@ class MailboxManager(Manager):
|
||||
qf = Q(pk__in=ids) & qf
|
||||
else:
|
||||
qf = Q(pk__in=ids)
|
||||
return self.get_query_set().select_related().filter(qf)
|
||||
return self.get_queryset().select_related().filter(qf)
|
||||
|
||||
|
||||
class Mailbox(AdminObject):
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
"""SimpleUsers views."""
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils.translation import ugettext as _
|
||||
@@ -38,9 +39,9 @@ def forward(request, tplname="admin/forward.html"):
|
||||
)
|
||||
|
||||
form = ForwardForm()
|
||||
if al is not None:
|
||||
if al is not None and al.recipients:
|
||||
form.fields["dest"].initial = al.recipients
|
||||
if al.aliasrecipient_set.filter(mailbox=mb.id).exists():
|
||||
if al.aliasrecipient_set.filter(r_mailbox=mb.pk).exists():
|
||||
form.fields["keepcopies"].initial = True
|
||||
return render_to_json_response({
|
||||
"content": _render_to_string(request, tplname, {
|
||||
|
||||
@@ -12,7 +12,6 @@ https://docs.djangoproject.com/en/1.6/ref/settings/
|
||||
import os
|
||||
from logging.handlers import SysLogHandler
|
||||
|
||||
from django.conf import global_settings
|
||||
{% if devmode %}
|
||||
from modoboa.core.dev_settings import *
|
||||
{% endif %}
|
||||
@@ -29,8 +28,6 @@ SECRET_KEY = '{{ secret_key }}'
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = {{ devmode }}
|
||||
|
||||
TEMPLATE_DEBUG = {{ devmode }}
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'{{ allowed_host }}'
|
||||
]
|
||||
@@ -87,9 +84,27 @@ AUTHENTICATION_BACKENDS = (
|
||||
'modoboa.lib.authbackends.SimpleBackend',
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
|
||||
'modoboa.core.context_processors.top_notifications',
|
||||
)
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.template.context_processors.i18n',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.static',
|
||||
'django.template.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'modoboa.core.context_processors.top_notifications',
|
||||
],
|
||||
'debug': {{ devmode }},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
ROOT_URLCONF = '{{ name }}.urls'
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ import re
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.forms import ChoiceField
|
||||
from django.forms.fields import CharField, Field
|
||||
from django.forms.widgets import RadioSelect, RadioInput
|
||||
from django.forms.widgets import RadioSelect
|
||||
from django.forms.widgets import RadioChoiceInput
|
||||
from django.shortcuts import render
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.utils.html import conditional_escape
|
||||
@@ -401,7 +402,7 @@ class DomainNameField(CharField):
|
||||
return super(DomainNameField, self).clean(value)
|
||||
|
||||
|
||||
class CustomRadioInput(RadioInput):
|
||||
class CustomRadioInput(RadioChoiceInput):
|
||||
def __unicode__(self):
|
||||
if 'id' in self.attrs:
|
||||
label_for = ' for="%s"' % self.attrs['id']
|
||||
|
||||
@@ -11,19 +11,6 @@ from modoboa.lib import parameters
|
||||
from modoboa.lib.exceptions import BadRequest
|
||||
|
||||
|
||||
class RelayDomainManager(Manager):
|
||||
|
||||
def get_for_admin(self, admin):
|
||||
"""Return the relay domains belonging to this admin.
|
||||
|
||||
The result is a ``QuerySet`` object, so this function can be used
|
||||
to fill ``ModelChoiceField`` objects.
|
||||
"""
|
||||
if admin.is_superuser:
|
||||
return self.get_query_set()
|
||||
return self.get_query_set().filter(owners__user=admin)
|
||||
|
||||
|
||||
class ServiceManager(Manager):
|
||||
|
||||
def load_from_master_cf(self):
|
||||
@@ -91,8 +78,6 @@ class RelayDomain(admin_models.AdminObject):
|
||||
default=False
|
||||
)
|
||||
|
||||
objects = RelayDomainManager()
|
||||
|
||||
class Meta:
|
||||
ordering = ["domain__name"]
|
||||
db_table = "postfix_relay_domains_relaydomain"
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
django>=1.7,<1.8
|
||||
django-reversion==1.8.5
|
||||
django>=1.8,<1.9
|
||||
django-reversion==1.9.3
|
||||
dj-database-url
|
||||
pycrypto
|
||||
argparse
|
||||
|
||||
Reference in New Issue
Block a user