Exemple #1
0
def login_permalink(request):
    form = LoginForm()
    post_auth_action = request.GET.get('post_auth_action', 'redirect')
    redirect_to = request.GET.get('redirect_to', None)
    redirect_to = redirect_to if redirect_to != "/login" else None
    if request.POST:
        form = LoginForm(request.POST)
        if form.is_valid():
            email_or_username = form.cleaned_data['username']
            password = form.cleaned_data['password']
            redirect_to = form.cleaned_data['redirect_to']
            post_auth_action = form.cleaned_data['post_auth_action']

            if redirect_to == None or redirect_to == 'None':
                redirect_to = "/"

            user = attempt_login(request, email_or_username, password)
            if user is not None and user.is_active:
                response = HttpResponseRedirect(redirect_to)
                if post_auth_action == 'close':
                    response = render(request, 'util/closing_window.html')

                return set_auth_cookies(response, user)
            else:
                form._errors["username"] = form.error_class(
                    ['The username and password you entered are incorrect.'])

    return render(
        request, 'user/login.html', {
            'title': 'Login',
            'redirect_to': redirect_to,
            'post_auth_action': post_auth_action,
            'login_form': form
        })
Exemple #2
0
def login_permalink(request):
    form = LoginForm()
    post_auth_action = request.GET.get('post_auth_action', 'redirect');
    redirect_to = request.GET.get('redirect_to', None)
    redirect_to = redirect_to if redirect_to != "/login" else None
    if request.POST:
        form = LoginForm(request.POST)
        if form.is_valid():
            email_or_username = form.cleaned_data['username']
            password = form.cleaned_data['password']
            redirect_to = form.cleaned_data['redirect_to']
            post_auth_action = form.cleaned_data['post_auth_action']

            if redirect_to == None or redirect_to == 'None':
                redirect_to = "/"

            user = attempt_login(request, email_or_username, password)
            if user is not None and user.is_active:
                response = HttpResponseRedirect(redirect_to)
                if post_auth_action == 'close':
                    response = render(request, 'util/closing_window.html')

                return set_auth_cookies(response, user)
            else:
                form._errors["username"] = form.error_class(['The username and password you entered are incorrect.'])

    return render(request, 'user/login.html', {
        'title' : 'Login',
        'redirect_to' : redirect_to,
        'post_auth_action' : post_auth_action,
        'login_form': form})
Exemple #3
0
def unsubscribe(request):
    id = request.GET['id']
    id_type = request.GET.get('id_type', 'user')
    code = request.GET['code']
    pub = request.GET.get('pub')
    pub_id = request.GET.get('pub_id')

    if id_type == 'user':
        try:
            user = User.objects.get(id=id, is_active=True)
        except ObjectDoesNotExist:
            raise Http404
    elif id_type == 'donor':
        try:
            user = Donor.objects.get(id=id)
        except ObjectDoesNotExist:
            raise Http404
    else:
        raise Http404

    expected_code = salted_hash(user.email)
    if code <> expected_code:
        raise Http404

    if pub:
        pub = pubs[pub]
        publication_id = pub.publication_id
    elif pub_id:
        publication_id = pub_id
    else:
        raise Http404

    pub = Publication.objects.get(id=publication_id)

    unsub, created = Unsubscribe.objects.get_or_create(email=user.email,
                                                       publication_id=pub.id)

    if pub.user_settings_field:
        # Update user table anyway to allow for resubscription, etc.
        setattr(user, pub.user_settings_field, 0)
        user.save()
        cache.bust_on_handle(user, user.username)
    else:
        try:
            if id_type == 'donor':
                sub = Subscription.objects.get(donor=user.id,
                                               publication=pub.id)
            elif id_type == 'user':
                sub = Subscription.objects.get(user=user.id,
                                               publication=pub.id)
            sub.subscribed = False
            sub.save()
            #cache.bust([user, sub])
        except ObjectDoesNotExist:
            raise Http404

    return render(request, 'etc/unsubscribe.html', {
        'created': created,
        'user': user,
    })
Exemple #4
0
def settings(request):
    success = False
    if request.method == 'POST':
        form = UserSettingsForm(request.POST, request.FILES, instance=request.user)

        old_pw_hash = request.user.password
        if form.is_valid():
            u = form.save(commit=False)
            if u.password:
                u.password = hash_password(u.password)
            else:
                u.password = old_pw_hash
            if form.cleaned_data['profile_pic']:
                u.upload_profile_pic(form.cleaned_data['profile_pic'])
            if form.cleaned_data['location_data']:
                u.location = Location.get_or_create(form.cleaned_data['location_data'])
            u.save()
            success = True
    else:
        if request.user.location:
            location_input = str(request.user.location)
            location_data = request.user.location.to_json()
        else:
            location_input = location_data = ''
        form = UserSettingsForm(instance=request.user, initial={'location_input':location_input,
                                                                'location_data':location_data,})

    return render(request, 'user/settings.html', {
            'success': success,  #to drop a little notice like "CONGRATS #WINNING"
            'entity':request.user,
            'form': form,
    })
Exemple #5
0
def claim_org_confirm(request, org_id):
    try:
        org = Org.objects.get(id = org_id)
    except:
        raise Http404

    return render(request, 'org/claimed.html', {'org' : org})
Exemple #6
0
def notification_email(request, username):
    user = User.objects.get(username = username, is_active=True)
    return render(request, "email/html/notifications/reset_password.html", {
            'hostname' : settings.HTTP_HOST,
            'subject': "You have just become a top advocate for FOO BAR on Jumo.",
            'user' : user,
            'entity' : user})
Exemple #7
0
def share(request, org_id):
    amount = request.GET.get('amount', None)
    org = Org.objects.get(id = org_id)

    return render(request, 'org/donate_success.html', {
            'amount':amount,
            'org':org,
            'title':'Share your donation to %s' % org.get_name
            })
Exemple #8
0
def notification_email(request, username):
    user = User.objects.get(username=username, is_active=True)
    return render(
        request, "email/html/notifications/reset_password.html", {
            'hostname': settings.HTTP_HOST,
            'subject':
            "You have just become a top advocate for FOO BAR on Jumo.",
            'user': user,
            'entity': user
        })
Exemple #9
0
def unsubscribe(request):
    id = request.GET['id']
    id_type = request.GET.get('id_type', 'user')
    code = request.GET['code']
    pub = request.GET.get('pub')
    pub_id = request.GET.get('pub_id')

    if id_type == 'user':
        try:
            user = User.objects.get(id=id, is_active=True)
        except ObjectDoesNotExist:
            raise Http404
    elif id_type == 'donor':
        try:
            user = Donor.objects.get(id=id)
        except ObjectDoesNotExist:
            raise Http404
    else:
        raise Http404

    expected_code = salted_hash(user.email)
    if code <> expected_code:
        raise Http404

    if pub:
        pub = pubs[pub]
        publication_id = pub.publication_id
    elif pub_id:
        publication_id = pub_id
    else:
        raise Http404

    pub = Publication.objects.get(id=publication_id)

    unsub, created = Unsubscribe.objects.get_or_create(email=user.email, publication_id=pub.id)

    if pub.user_settings_field:
        # Update user table anyway to allow for resubscription, etc.
        setattr(user, pub.user_settings_field, 0)
        user.save()
        cache.bust_on_handle(user, user.username)
    else:
        try:
            if id_type=='donor':
                sub = Subscription.objects.get(donor=user.id, publication=pub.id)
            elif id_type=='user':
                sub = Subscription.objects.get(user=user.id, publication=pub.id)
            sub.subscribed=False
            sub.save()
            #cache.bust([user, sub])
        except ObjectDoesNotExist:
            raise Http404

    return render(request, 'etc/unsubscribe.html', {'created': created,
                     'user': user,})
Exemple #10
0
def setup(request):
    sans_facebook = True if request.GET.has_key(
        'sans_facebook') and request.GET['sans_facebook'] else False
    redirect_to = request.GET.get('redirect_to', "/")

    form = CreateAccountForm(initial={
        'redirect_to': redirect_to,
    })
    if request.POST:
        sans_facebook = True if request.POST.has_key(
            'sans_facebook') and request.POST['sans_facebook'] else False
        form = CreateAccountForm(request.POST)
        if form.is_valid():
            u = User()
            u.bio = form.cleaned_data['bio']
            u.birth_year = form.cleaned_data['birth_year']
            u.email = u.long_email = form.cleaned_data['email']
            u.fb_access_token = form.cleaned_data['fb_access_token']
            u.gender = form.cleaned_data['gender']
            u.first_name = form.cleaned_data['first_name']
            u.last_name = form.cleaned_data['last_name']
            u.facebook_id = form.cleaned_data['fbid']
            u.bio = u.bio.encode('utf-8') if u.bio else ""
            u.first_name = u.first_name.encode('utf-8') if u.first_name else ""
            u.last_name = u.last_name.encode('utf-8') if u.last_name else ""
            if form.cleaned_data['location_data']:
                u.location = Location.get_or_create(
                    form.cleaned_data['location_data'])
            u.next_email_time = datetime.datetime.now() + timedelta(days=1)
            u.username = create_handle('%s%s' % (u.first_name, u.last_name))
            u.password = hash_password(form.cleaned_data['password'])
            u.save()

            Subscription.get_or_create(user=u, pub_id=NOTIFICATIONS_PUB)

            #Post to Facebook
            if form.cleaned_data['post_to_facebook']:
                fb_helpers.post_joined_to_wall(u)

            cache.put_on_handle(u, u.username)

            redirect_to = form.cleaned_data['redirect_to'] or '/'
            #perform for all that login magic that happens under the covers
            attempt_login(request, u.username, form.cleaned_data["password"])
            return set_auth_cookies(HttpResponseRedirect(redirect_to), u)

    return render(
        request, 'user/setup.html', {
            'title': 'Setup your account',
            'create_form': form,
            'sans_facebook': sans_facebook,
        })
Exemple #11
0
def forgot_password(request):
    error = None
    if request.method == 'POST':
        if 'email' in request.POST:
            try:
                u = User.objects.get(email=request.POST['email'].strip(),
                                     is_active=True)
                pr = PasswordResetRequest()
                pr.user = u
                pr.uid = str(uuid4().hex)
                pr.save()
                send_notification(type=EmailTypes.RESET_PASSWORD,
                                  user=u,
                                  entity=u,
                                  password_reset_id=pr.uid)
                return render(request, 'user/forgot_password_confirm.html', {})
            except User.DoesNotExist:
                error = "Sorry, this user account does not exist."
            except Exception:
                logging.exception("Error In Forgot Password Post")
                error = "Sorry, an unknown error has occurred."
    return render(request, 'user/forgot_password.html', {'error': error})
Exemple #12
0
def forgot_password(request):
    error = None
    if request.method == 'POST':
        if 'email' in request.POST:
            try:
                u = User.objects.get(email = request.POST['email'].strip(), is_active=True)
                pr = PasswordResetRequest()
                pr.user = u
                pr.uid = str(uuid4().hex)
                pr.save()
                send_notification(type=EmailTypes.RESET_PASSWORD,
                                  user=u,
                                  entity=u,
                                  password_reset_id=pr.uid)
                return render(request, 'user/forgot_password_confirm.html', {})
            except User.DoesNotExist:
                error = "Sorry, this user account does not exist."
            except Exception:
                logging.exception("Error In Forgot Password Post")
                error = "Sorry, an unknown error has occurred."
    return render(request, 'user/forgot_password.html', {
        'error' : error
    })
Exemple #13
0
def return_org(request, org):
    if request.user.is_authenticated():
        related_orgs = org.get_related_orgs_for_user(request.user)[:5]
    else:
        related_orgs = org.get_all_related_orgs[:5]

    is_allowed_to_edit = org.is_editable_by(request.user)

    return render(request, 'org/profile.html', {
        'entity' : org,
        'title' : org.name,
        'related_orgs' : related_orgs,
        'is_allowed_to_edit': is_allowed_to_edit,
    })
Exemple #14
0
def create_org(request):
    if request.POST:
        form = CreateOrgForm(request.POST)
        if form.is_valid():
            org = form.save()
            org.admins.add(request.user)
            return redirect('details_org', org.id)
    else:
        form = CreateOrgForm()

    return render(request, 'org/create.html', {
        'title': 'Add an organization',
        'form': form,
    })
Exemple #15
0
def connect(request):
    success = False
    if request.POST:
        form = UserConnectForm(request.POST, instance=request.user)
        if form.is_valid():
            form.save()
            success = True
    else:
        form = UserConnectForm(instance=request.user)

    return render(request, 'user/connect.html', {
        'form': form,
        'success': success,  #to drop a little notice like "CONGRATS #WINNING"
    })
Exemple #16
0
def return_org(request, org):
    if request.user.is_authenticated():
        related_orgs = org.get_related_orgs_for_user(request.user)[:5]
    else:
        related_orgs = org.get_all_related_orgs[:5]

    is_allowed_to_edit = org.is_editable_by(request.user)

    return render(
        request, 'org/profile.html', {
            'entity': org,
            'title': org.name,
            'related_orgs': related_orgs,
            'is_allowed_to_edit': is_allowed_to_edit,
        })
Exemple #17
0
def signed_out_home(request):
    lists = Section.get_lists(Sections.HOME)
    list_ids = [l.id for l in lists]
    top_lists = TopList.get_entities_for_lists(list_ids)

    top_categories, sub_category_groups, discovery_item_groups = DiscoveryMap.get_lists()

    return render(request, 'etc/home.html', {
            'title' : None,
            'login_form':LoginForm(),
            'top_categories': top_categories,
            'sub_category_groups': sub_category_groups,
            'discovery_item_groups': discovery_item_groups,
            'top_lists': top_lists
        })
Exemple #18
0
def details(request, org_id):
    org = get_object_or_404(Org, id=org_id)
    if not org.is_editable_by(request.user):
        raise Http404

    if request.POST:
        form = DetailsOrgForm(request.POST, instance=org)
        if form.is_valid():
            form.save()
            return redirect('manage_org', org.id)
    else:
        form = DetailsOrgForm(instance=org)

    return render(request, 'org/details.html', {
        'form': form,
        'org': org,
    })
Exemple #19
0
def setup(request):
    sans_facebook = True if request.GET.has_key('sans_facebook') and request.GET['sans_facebook'] else False
    redirect_to = request.GET.get('redirect_to', "/")

    form = CreateAccountForm(initial={'redirect_to': redirect_to,})
    if request.POST:
        sans_facebook = True if request.POST.has_key('sans_facebook') and request.POST['sans_facebook'] else False
        form = CreateAccountForm(request.POST)
        if form.is_valid():
            u = User()
            u.bio = form.cleaned_data['bio']
            u.birth_year = form.cleaned_data['birth_year']
            u.email = u.long_email = form.cleaned_data['email']
            u.fb_access_token = form.cleaned_data['fb_access_token']
            u.gender = form.cleaned_data['gender']
            u.first_name = form.cleaned_data['first_name']
            u.last_name = form.cleaned_data['last_name']
            u.facebook_id = form.cleaned_data['fbid']
            u.bio = u.bio.encode('utf-8') if u.bio else ""
            u.first_name = u.first_name.encode('utf-8') if u.first_name else ""
            u.last_name = u.last_name.encode('utf-8') if u.last_name else ""
            if form.cleaned_data['location_data']:
                u.location = Location.get_or_create(form.cleaned_data['location_data'])
            u.next_email_time = datetime.datetime.now() + timedelta(days = 1)
            u.username = create_handle('%s%s' % (u.first_name, u.last_name))
            u.password = hash_password(form.cleaned_data['password'])
            u.save()

            Subscription.get_or_create(user = u, pub_id = NOTIFICATIONS_PUB)

            #Post to Facebook
            if form.cleaned_data['post_to_facebook']:
                fb_helpers.post_joined_to_wall(u)

            cache.put_on_handle(u, u.username)

            redirect_to = form.cleaned_data['redirect_to'] or '/'
            #perform for all that login magic that happens under the covers
            attempt_login(request, u.username, form.cleaned_data["password"])
            return set_auth_cookies(HttpResponseRedirect(redirect_to), u)

    return render(request, 'user/setup.html', {
        'title' : 'Setup your account',
        'create_form' : form,
        'sans_facebook': sans_facebook,
        })
Exemple #20
0
def upload_photo(request):
    if request.method == 'POST':
        form = PhotoUploadForm(request.POST, request.FILES, instance=request.user)

        if form.is_valid():
            u = form.save(commit=False)
            u.upload_profile_pic(form.cleaned_data['profile_pic'])
            u.save()
            return HttpResponseRedirect("/")
    else:
        form = PhotoUploadForm(instance=request.user)

    return render(request, 'user/photo_upload.html', {
            'user_photo_upload_form': form,
            'entity':request.user,
            'form': form,
    })
Exemple #21
0
def signed_out_home(request):
    lists = Section.get_lists(Sections.HOME)
    list_ids = [l.id for l in lists]
    top_lists = TopList.get_entities_for_lists(list_ids)

    top_categories, sub_category_groups, discovery_item_groups = DiscoveryMap.get_lists(
    )

    return render(
        request, 'etc/home.html', {
            'title': None,
            'login_form': LoginForm(),
            'top_categories': top_categories,
            'sub_category_groups': sub_category_groups,
            'discovery_item_groups': discovery_item_groups,
            'top_lists': top_lists
        })
Exemple #22
0
def connect(request):
    success = False
    if request.POST:
        form = UserConnectForm(request.POST, instance=request.user)
        if form.is_valid():
            form.save()
            success = True
    else:
        form = UserConnectForm(instance=request.user)

    return render(
        request,
        'user/connect.html',
        {
            'form': form,
            'success':
            success,  #to drop a little notice like "CONGRATS #WINNING"
        })
Exemple #23
0
def upload_photo(request):
    if request.method == 'POST':
        form = PhotoUploadForm(request.POST,
                               request.FILES,
                               instance=request.user)

        if form.is_valid():
            u = form.save(commit=False)
            u.upload_profile_pic(form.cleaned_data['profile_pic'])
            u.save()
            return HttpResponseRedirect("/")
    else:
        form = PhotoUploadForm(instance=request.user)

    return render(request, 'user/photo_upload.html', {
        'user_photo_upload_form': form,
        'entity': request.user,
        'form': form,
    })
Exemple #24
0
def settings(request):
    success = False
    if request.method == 'POST':
        form = UserSettingsForm(request.POST,
                                request.FILES,
                                instance=request.user)

        old_pw_hash = request.user.password
        if form.is_valid():
            u = form.save(commit=False)
            if u.password:
                u.password = hash_password(u.password)
            else:
                u.password = old_pw_hash
            if form.cleaned_data['profile_pic']:
                u.upload_profile_pic(form.cleaned_data['profile_pic'])
            if form.cleaned_data['location_data']:
                u.location = Location.get_or_create(
                    form.cleaned_data['location_data'])
            u.save()
            success = True
    else:
        if request.user.location:
            location_input = str(request.user.location)
            location_data = request.user.location.to_json()
        else:
            location_input = location_data = ''
        form = UserSettingsForm(instance=request.user,
                                initial={
                                    'location_input': location_input,
                                    'location_data': location_data,
                                })

    return render(
        request,
        'user/settings.html',
        {
            'success':
            success,  #to drop a little notice like "CONGRATS #WINNING"
            'entity': request.user,
            'form': form,
        })
Exemple #25
0
def search_page(request):
    search_results = []
    orgs_near_me = []
    query = request.GET.get('q',None)
    search_results = Autocomplete.search(query)
    orgs_near_me = _get_orgs_near_me(request, query)
    more_results = search_results.hits > DEFAULT_LIMIT    
    related_searches = _get_related_searches(query)

    more_results = search_results.hits > DEFAULT_LIMIT

    title = "for %s" % query if query else ''

    return render(request, 'search/base.html', {
            'search_results' : search_results,
            'more_results': more_results,
            'query': query,
            'orgs_near_me': orgs_near_me,
            'related_searches': related_searches,
            'title' : "Search %s" % title
            })
Exemple #26
0
def reset_password(request, reset_id):
    error = None
    if request.method == 'POST' and 'password' in request.POST and request.POST['password']:
        try:
            p = PasswordResetRequest.objects.get(uid = reset_id)
            u = p.user
            u.password = hash_password(request.POST['password'].strip())
            u.save()

            #perform for all that login magic that happens under the covers
            user = attempt_login(request, u.username, request.POST['password'].strip())
            p.delete()
            return set_auth_cookies(HttpResponseRedirect('/'), user)
        except Exception:
            logging.exception("Error In Reset Password")
            error = 'There was an error resetting your password.'

    return render(request, 'user/reset_password.html', {
        'error' : error,
        'reset_token' : reset_id,
    })
Exemple #27
0
def home(request):
    top_categories, sub_category_groups, discovery_item_groups = DiscoveryMap.get_lists()
    list_ids = [l.id for l in Section.get_lists(Sections.SIGNED_IN_HOME)]
    lists = TopList.get_entities_for_lists(list_ids)
    if len(lists) > 0:
        recommended_orgs = lists.items()[0][1]
    else:
        recommended_orgs = []


    form = PhotoUploadForm(instance=request.user)

    return render(request, 'user/home.html', {
            'user_photo_upload_form': form,
            'title' : 'Home',
            'entity' : None,
            'top_categories': top_categories,
            'sub_category_groups': sub_category_groups,
            'discovery_item_groups': discovery_item_groups,
            'recommended_orgs': recommended_orgs
    })
Exemple #28
0
def home(request):
    top_categories, sub_category_groups, discovery_item_groups = DiscoveryMap.get_lists(
    )
    list_ids = [l.id for l in Section.get_lists(Sections.SIGNED_IN_HOME)]
    lists = TopList.get_entities_for_lists(list_ids)
    if len(lists) > 0:
        recommended_orgs = lists.items()[0][1]
    else:
        recommended_orgs = []

    form = PhotoUploadForm(instance=request.user)

    return render(
        request, 'user/home.html', {
            'user_photo_upload_form': form,
            'title': 'Home',
            'entity': None,
            'top_categories': top_categories,
            'sub_category_groups': sub_category_groups,
            'discovery_item_groups': discovery_item_groups,
            'recommended_orgs': recommended_orgs
        })
Exemple #29
0
def search_page(request):
    search_results = []
    orgs_near_me = []
    query = request.GET.get('q', None)
    search_results = Autocomplete.search(query)
    orgs_near_me = _get_orgs_near_me(request, query)
    more_results = search_results.hits > DEFAULT_LIMIT
    related_searches = _get_related_searches(query)

    more_results = search_results.hits > DEFAULT_LIMIT

    title = "for %s" % query if query else ''

    return render(
        request, 'search/base.html', {
            'search_results': search_results,
            'more_results': more_results,
            'query': query,
            'orgs_near_me': orgs_near_me,
            'related_searches': related_searches,
            'title': "Search %s" % title
        })
Exemple #30
0
def reset_password(request, reset_id):
    error = None
    if request.method == 'POST' and 'password' in request.POST and request.POST[
            'password']:
        try:
            p = PasswordResetRequest.objects.get(uid=reset_id)
            u = p.user
            u.password = hash_password(request.POST['password'].strip())
            u.save()

            #perform for all that login magic that happens under the covers
            user = attempt_login(request, u.username,
                                 request.POST['password'].strip())
            p.delete()
            return set_auth_cookies(HttpResponseRedirect('/'), user)
        except Exception:
            logging.exception("Error In Reset Password")
            error = 'There was an error resetting your password.'

    return render(request, 'user/reset_password.html', {
        'error': error,
        'reset_token': reset_id,
    })
Exemple #31
0
def return_issue(request, issue):
    return render(request, 'issue/profile.html', {
        'entity' : issue,
        'title' : issue.name,
    })
Exemple #32
0
def developer(request):
    if request.POST:
        request.user.generate_new_api_key()
    return render(request, 'user/developer.html', {})
Exemple #33
0
def team(request):
    return render(request, 'etc/team.html', {"title": "Our Team"})
Exemple #34
0
def about(request):
    return render(request, 'etc/about.html', {
            "title": "About"
            })
Exemple #35
0
def contact(request):
    return render(request, 'etc/contact.html', {
            "title": "Contact Us"
            })
Exemple #36
0
def team(request):
    return render(request, 'etc/team.html', {
            "title": "Our Team"
            })
Exemple #37
0
def jobs(request):
    return render(request, 'etc/jobs.html', {
            "title": "Jobs"
            })
Exemple #38
0
def return_issue(request, issue):
    return render(request, 'issue/profile.html', {
        'entity': issue,
        'title': issue.name,
    })
Exemple #39
0
def terms(request):
    return render(request, 'etc/terms.html', {"title": "Terms of Service"})
Exemple #40
0
def blog(request):
    return render(
        request, 'etc/blog.html', {
            "title":
            "Jumo and GOOD Combine Forces to Create Content and Social Engagement Platform"
        })
Exemple #41
0
def privacy(request):
    return render(request, 'etc/privacy.html', {"title": "Privacy Policy"})
Exemple #42
0
def jobs(request):
    return render(request, 'etc/jobs.html', {"title": "Jobs"})
Exemple #43
0
def help(request):
    return render(request, 'etc/help.html', {"title": "Help"})
Exemple #44
0
def terms(request):
    return render(request, 'etc/terms.html', {
            "title": "Terms of Service"
            })
Exemple #45
0
def return_user(request, user):
    return render(request, 'user/profile.html', {
        'entity': user,
        'title': user.get_name,
    })
Exemple #46
0
def privacy(request):
    return render(request, 'etc/privacy.html', {
            "title": "Privacy Policy"
            })
Exemple #47
0
def discover(request):
    return render(request, 'user/discover.html', {
        'title' : 'Discover'
        })
Exemple #48
0
def help(request):
    return render(request, 'etc/help.html', {
            "title": "Help"
            })
Exemple #49
0
def developer(request):
    if request.POST:
        request.user.generate_new_api_key()
    return render(request, 'user/developer.html', {})
Exemple #50
0
        form_class = ManageOrgMoreForm
        form_url = reverse('manage_org_more', args=[org_id])

    success = False
    if request.method == "POST":
        form = form_class(request.POST, request.FILES, instance=org)
        if form.is_valid():
            form.save()
            success = True
    else:
        form = form_class(instance=org)

    return render(request, 'org/manage.html', {
        'title': 'Manage',
        'entity': org,
        'form': form,
        'form_url': form_url,
        'tab': tab,
        'success': success,
    })

@secure
def donate(request, handle):
    initial_amount = int(request.GET.get("amount", 0))
    initial_user = request.user if not request.user.is_anonymous() else None
    org = Org.objects.get(handle = handle)
    form = StandardDonationForm(initial_amount=initial_amount,initial_user=initial_user)

    if request.POST:
        form = StandardDonationForm(data=request.POST)
        if form.is_valid():
            donation_data = form.to_donation_data(org)
Exemple #51
0
def discover(request):
    return render(request, 'user/discover.html', {'title': 'Discover'})
Exemple #52
0
def blog(request):
    return render(request, 'etc/blog.html', {
            "title": "Jumo and GOOD Combine Forces to Create Content and Social Engagement Platform"
            })
Exemple #53
0
def return_user(request, user):
    return render(request, 'user/profile.html', {
        'entity' : user,
        'title' : user.get_name,
    })
Exemple #54
0
def about(request):
    return render(request, 'etc/about.html', {"title": "About"})
Exemple #55
0
def contact(request):
    return render(request, 'etc/contact.html', {"title": "Contact Us"})