# The middleware

    from django.conf import settings
    from datetime import timedelta, date

    class KeepLoggedInMiddleware(object):
        def process_request(self, request):
            if not request.user.is_authenticated() or not settings.KEEP_LOGGED_KEY in request.session:
                return
            if request.session[settings.KEEP_LOGGED_KEY] != date.today():
                request.session.set_expiry(timedelta(days=settings.KEEP_LOGGED_DURATION))
                request.session[settings.KEEP_LOGGED_KEY] = date.today()
            return

# Add to settings
1. unit_name.KeepLoggedInMiddleware to the bottom of MIDDLEWARE_CLASSES
2. 
    KEEP_LOGGED_KEY                   = 'keep_me_logged' # session key
    KEEP_LOGGED_DURATION              = 365         # in days


# In your login view

    form = LoginForm(request.POST)
    
    if form.is_valid():
            # some code

            if form.remember:
                request.session[settings.KEEP_LOGGED_KEY] = True