Exemple #1
0
    def get(self):
        id = self.request.get("id")
        logging.warning(id)
        q = models.check_if_user_profile_exists(id)
        if q == []:
            models.create_profile(id)

        page_params = {
            'user_email': get_user_email(),
            'login_url': users.create_login_url(),
            'logout_url': users.create_logout_url('/'),
            "list": models.obtain_events(),
            'user_id': get_user_id(),
            'profile': models.get_user_profile(id),
        }
        render_template(self, 'profile.html', page_params)
Exemple #2
0
	def get(self):
		id = self.request.get("id")
		logging.warning(id)
		q = models.check_if_user_profile_exists(id)
		if q == []:
			models.create_profile(id)

		page_params = {
			'user_email': get_user_email(),
			'login_url': users.create_login_url(),
			'logout_url': users.create_logout_url('/'),
			"list": models.obtain_events(),
			'user_id': get_user_id(),
			'profile': models.get_user_profile(id),
		}
		render_template(self, 'profile.html', page_params)
Exemple #3
0
    def post(self):
        k = self.request.get('keys')

        ks = json.loads(k)

        def _order(k):
            if k['isGroup']:
                g = models.Group.get_by_id(long(k['id']))
                g.order = map(_order, k['subs'])
                g.put()

            return long(k['id'])
                
        p = models.get_user_profile()
        p.order = map(_order, ks)
        p.put()
def profile_page():
    """
    Web Page to display The Profile Index Page
    """

    profile = get_user_profile(current_user.get_id())
    user_profile = Profile(profile[0], profile[1], profile[2], profile[3],
                           profile[4], profile[5], profile[6])
    #form = model_form(user_profile, UserProfileForm)

    user_id = current_user.get_id()
    records = resource_summary(user_id)
    results = []
    for record in records:
        value = ResourceStatus(record[0], record[1], None, None, None, None,
                               record[2], None)
        results.append(value)
    #return render_template("profile.html",records=results)

    return render_template("profile.html", form=user_profile, records=results)
Exemple #5
0
def login(request):
    # mostly copied from zamboni
    logout(request)

    r = django.contrib.auth.views.login(request,
                         template_name='users/login.html',
                         redirect_field_name=REDIRECT_FIELD_NAME,
                         authentication_form=forms.AuthenticationForm)

    if isinstance(r, http.HttpResponseRedirect):
        # Succsesful log in according to django. Now we do our checks. I do
        # the checks here instead of the form's clean() because I want to use
        # the messages framework and it's not available in the request there
        user = get_user_profile(request.user)
        rememberme = request.POST.get('rememberme', None)
        if rememberme:
            request.session.set_expiry(settings.SESSION_COOKIE_AGE)
            logging.debug((u'User (%s) logged in successfully with '
                                        '"remember me" set') % user)

    return r