Mr Shang

我是一个勤劳的码农,每天在技术的牧场辛勤劳作


导航栏
 » 首页
 » 分类浏览
 » 关于我
 » 我的Github
 » RSS订阅
Group 59

  1. Javascript Validator for Input Number

    This javascript will validate/allow the number only when event key is pressed. For example result of it:

  2. Setup Django in apache2 Raspberry Pi

    Setup Django in apache2 Raspberry Pi. Example in this configuration for monitoring the server raspberry pi using https://github.com/k3oni/pydash/.

    As following this configurations https://github.com/k3oni/pydash/wiki/Install-pyDash#3-setup-apache, how to setup it.

  3. Adding BroadCast Mail to All Users Registered inside Django Admin

    Adding BroadCast Mail to All User Registered in Django Admin. This is my last problem, we need custom default Django Admin to can submit BroadCast mail to All User. Because this is perfectly to make a promotions.

  4. Custom redirect urls django

    Example in this problem we need redirect the url http://localhost:8000/a/b/C/123/4/5/ to http://localhost:8000/abC12345 without / slash.

    1. In your views.py
    from django.http import HttpResponse
    from django.views.generic.base import RedirectView
    from django.core.urlresolvers import reverse
    
    #Ref: http://stackoverflow.com/a/16627830/3445802
    class UserRedirectView(RedirectView):
        permanent = False
        def get_redirect_url(self, pk):
            pk = ''.join(str(pk).split('/'))
            return reverse('pool_fix_page', kwargs={'pk': pk})
    
    def pool_fix(request, pk):
        return HttpResponse("You're looking at question %s." % pk)
© Mr Shang - niceshang[#]outlook.com - Powered by Jekyll.