Пример #1
0
def save_theme(request,theme):
    if (request.user.is_authenticated()):
        try:
            setting=None
            try:
                setting=User_Settings.objects.get(user=request.user)
                setting.theme=theme
            except:
                setting=User_Settings(user=request.user,theme=theme)
            setting.save()
        except:
            pass
    return HttpResponse("")
Пример #2
0
def save_profile(request):
    if (request.user.is_authenticated()):
        try:
            setting=None
            theme=0
            catalogue='C'
            try:
                theme=request.GET["theme"]
                catalogue=request.GET["catalogue"]
                catalogue_columns=request.GET["catalogue_columns"]
            except:
                return HttpResponse("")
            try:
                setting=User_Settings.objects.get(user=request.user)
                setting.theme=theme
                setting.catalogue=catalogue
                setting.catalogue_columns=catalogue_columns
            except:
                setting=User_Settings(user=request.user,theme=theme,catalogue=catalogue,catalogue_columns=catalogue_columns)
            setting.save()
        except:
            pass
    return HttpResponse("")
Пример #3
0
def activate_user(request,username,arg):
    user=None
    try:
        user=User.objects.get(username=username)
    except:
        return render_to_response('main/registration.html',{'message':u"Ошибка активации!"})
    if (str(arg)==str(abs(str(user.date_joined).__hash__())) and not user.is_active):
        user.is_active=True
        #Создаем для пользователя настройки и пользовательский каталог по умолчанию
        user.save()
        catalogue = User_Catalogue()
        catalogue.user = user
        catalogue.save()
        settings = User_Settings()
        settings.user = user
        settings.default_catalogue = catalogue
        settings.theme = 1
        settings.save()
        user.save()
        return render_to_response('main/registration.html',{'message':u"Пользователь "+username+u" успешно активирован!"})
    else:
        return render_to_response('main/registration.html',{'message':u"Ошибка активации!"})