예제 #1
0
파일: models.py 프로젝트: wiedi/limeade
	def utilization(user, ressource):
		domains = get_domains(user)
		if ressource == 'accounts':
			return VHost.objects.filter(domain__in=list(domains)).count()
		if ressource == 'redirects':
			return HTTPRedirect.objects.filter(domain__in=list(domains)).count()
		return None
예제 #2
0
 def utilization(user, ressource):
     """Returns the correct ressource."""
     domains = get_domains(user)
     if ressource == 'accounts':
         return Account.objects.filter(domain__in=list(domains)).count()
     if ressource == 'redirects':
         return Redirect.objects.filter(domain__in=list(domains)).count()
     return None
예제 #3
0
파일: models.py 프로젝트: fatality/limeade
 def utilization(user, ressource):
     """Returns the correct ressource."""
     domains = get_domains(user)
     if ressource == 'accounts':
         return Account.objects.filter(domain__in=list(domains)).count()
     if ressource == 'redirects':
         return Redirect.objects.filter(domain__in=list(domains)).count()
     return None
예제 #4
0
def redirect_list(request):
    """List all mail redirects.
    
    :param request: the request object
    
    :returns: a list of mail redirects
    """
    domains = get_domains(request.user)
    return object_list(request, Redirect.objects.filter(domain__in = domains), template_name='limeade_mail/redirect_list.html')
예제 #5
0
 def utilization(user, ressource):
     """Filters specific ressources."""
     domains = get_domains(user)
     if ressource == 'accounts':
         return VHost.objects.filter(domain__in=list(domains)).count()
     if ressource == 'redirects':
         return HTTPRedirect.objects.filter(
             domain__in=list(domains)).count()
     return None
예제 #6
0
파일: views.py 프로젝트: fatality/limeade
def vhost_list(request):
    """List of web-vhosts.
    
    :param request: the request object
    
    :returns: list of web vhosts
    """
    domains = get_domains(request.user)
    return object_list(request, VHost.objects.filter(domain__in = domains), template_name='limeade_web/vhost_list.html')
예제 #7
0
def account_list(request):
    """List all mail accounts of a user.
    
    :param request: the request object
    
    :returns: a list of mail accounts
    """
    domains = get_domains(request.user)
    return object_list(request, Account.objects.filter(domain__in = domains), template_name='limeade_mail/account_list.html')
예제 #8
0
파일: views.py 프로젝트: wiedi/limeade
def redirect_add(request):
	"Create a new mail redirect"
	form = RedirectForm(request.POST or None)
	form.fields['domain'].queryset = get_domains(request.user)
	if form.is_valid():
		form.save()
		return redirect('limeade_mail_redirect_list')
	return render_to_response("limeade_mail/redirect_add.html",
		{"form": form}, context_instance = RequestContext(request))
예제 #9
0
파일: views.py 프로젝트: wiedi/limeade
def redirect_edit(request, slug):
	"Edit a HTTP redirect"
	r = Redirect.objects.get(pk=slug)
	form = RedirectForm(request.POST or None, instance=r)
	form.fields['domain'].queryset = get_domains(request.user)
	if form.is_valid():
		form.save()
		return redirect('limeade_web_redirect_list')
	return render_to_response("limeade_web/redirect_edit.html",
		{"form": form}, context_instance = RequestContext(request))
예제 #10
0
def vhost_list(request):
    """List of web-vhosts.
    
    :param request: the request object
    
    :returns: list of web vhosts
    """
    domains = get_domains(request.user)
    return object_list(request,
                       VHost.objects.filter(domain__in=domains),
                       template_name='limeade_web/vhost_list.html')
예제 #11
0
파일: views.py 프로젝트: wiedi/limeade
def account_add(request):
	"Add a new mail account"
	form = AccountForm(request.POST or None)
	form.fields['domain'].queryset = get_domains(request.user)
	if form.is_valid():
		ac = form.save(commit=False)
		ac.set_password(form.cleaned_data['password'])
		ac.save()
		return redirect('limeade_mail_account_list')
	return render_to_response("limeade_mail/account_add.html",
		{"form": form}, context_instance = RequestContext(request))
예제 #12
0
def redirect_add(request):
    """Create a new mail redirect.
    
    :param request: the request object
    
    :returns: an edit form template
    """
    form = RedirectForm(request.POST or None)
    form.fields['domain'].queryset = get_domains(request.user)
    if form.is_valid():
        form.save()
        return redirect('limeade_mail_redirect_list')
    return render_to_response("limeade_mail/redirect_add.html",
        {"form": form}, context_instance = RequestContext(request))
예제 #13
0
파일: views.py 프로젝트: fatality/limeade
def vhost_add(request):
    """Create a new web-vhost.
    
    :param request: the request object
    
    :returns: an edit form template
    """
    form = VHostForm(request.POST or None)
    form.fields['domain'].queryset = get_domains(request.user)
    if form.is_valid():
        form.save()
        return redirect('limeade_web_vhost_list')
    return render_to_response("limeade_web/vhost_add.html",
        {"form": form}, context_instance = RequestContext(request))
예제 #14
0
def account_add(request):
    """Add a new mail account.
    
    :param request: the request object
    
    :returns: an edit form template
    """
    form = AccountForm(request.POST or None)
    form.fields['domain'].queryset = get_domains(request.user)
    if form.is_valid():
        ac = form.save(commit=False)
        ac.set_password(form.cleaned_data['password'])
        ac.save()
        return redirect('limeade_mail_account_list')
    return render_to_response("limeade_mail/account_add.html",
        {"form": form}, context_instance = RequestContext(request))
예제 #15
0
def redirect_edit(request, slug):
    """Edit a HTTP redirect.
    
    :param request: the request object
    :param slug: the id of the redirect
    
    :returns: an edit form template
    """
    r = Redirect.objects.get(pk=slug)
    form = RedirectForm(request.POST or None, instance=r)
    form.fields['domain'].queryset = get_domains(request.user)
    if form.is_valid():
        form.save()
        return redirect('limeade_web_redirect_list')
    return render_to_response("limeade_web/redirect_edit.html", {"form": form},
                              context_instance=RequestContext(request))
예제 #16
0
파일: views.py 프로젝트: fatality/limeade
def redirect_edit(request, slug):
    """Edit a mail redirect.
    
    :param request: the request object
    :param slug: the id of the redirect
    
    :returns: an edit form template
    """
    r = Redirect.objects.get(pk=slug)
    if r.domain.owner() != request.user:
        return redirect('limeade_mail_redirect_list')       
    form = RedirectForm(request.POST or None, instance=r)
    form.fields['domain'].queryset = get_domains(request.user)
    if form.is_valid():
        form.save()
        return redirect('limeade_mail_redirect_list')
    return render_to_response("limeade_mail/redirect_edit.html",
        {"form": form}, context_instance = RequestContext(request))
예제 #17
0
파일: views.py 프로젝트: wiedi/limeade
def redirect_list(request):
	"List all mail redirects"
	domains = get_domains(request.user)
	return object_list(request, Redirect.objects.filter(domain__in = domains), template_name='limeade_mail/redirect_list.html')
예제 #18
0
파일: views.py 프로젝트: wiedi/limeade
def account_list(request):
	"List all mail accounts of a user"
	domains = get_domains(request.user)
	return object_list(request, Account.objects.filter(domain__in = domains), template_name='limeade_mail/account_list.html')
예제 #19
0
def get_vhosts(user):
    """Returns all vhosts that belongs to one user."""
    return VHost.objects.filter(domain__in=list(get_domains(user)))
예제 #20
0
파일: models.py 프로젝트: wiedi/limeade
def get_vhosts(user):
	return VHost.objects.filter(domain__in=list(get_domains(user)))
예제 #21
0
파일: models.py 프로젝트: fatality/limeade
def get_vhosts(user):
    """Returns all vhosts that belongs to one user."""
    return VHost.objects.filter(domain__in=list(get_domains(user)))