Exemplo n.º 1
0
def create_auto_portfolio(sender, instance, *args, **kwargs):
    '''
    Automatically creates a default portfolio for each platform.
    '''
    try:
        if not instance.portfolios.exists():
            new_portfolio = Portfolio(id=None,
                                      name="Default",
                                      platform=instance,
                                      template=False,
                                      auto_created=True)
            new_portfolio.save()
    except Exception as e:
        print(e)
Exemplo n.º 2
0
def index(request):
    if not users.is_current_user_admin():
        return redirect(users.create_login_url("/"))

    portfolios = Portfolio.all().order("-completed")

    data = {"test": "test", "portfolios": portfolios, "users": users}

    return render_to_response("portfolios/index.html", data, context_instance=RequestContext(request))
Exemplo n.º 3
0
def index(request):
    active_date = date(2005, 2, 7)
    query = db.Query(Skill)
    query.filter('active =', True)
    query.order('order')
    active_skills = query.fetch(10)

    query = db.Query(Skill)
    query.filter('active =', False)
    inactive_skills = query.fetch(10)

    portfolios = Portfolio.all().order('-completed')

    data = {
        'active_date': active_date,
        'active_skills': active_skills,
        'entries': _blog_entries(), 
        'inactive_skills': inactive_skills,
        'portfolios': portfolios,
        'today': datetime.today()
    }

    return render_to_response('index.html', data)
Exemplo n.º 4
0
def update(request, slug):
    if not users.is_current_user_admin():
        return redirect(users.create_login_url("/"))

    portfolio = Portfolio.all().filter("slug =", slug)
    if portfolio.count():
        portfolio = portfolio[0]
    else:
        raise Http404

    success = False

    if request.method == "POST":
        form = PortfolioForm(request.POST, instance=portfolio)
        if form.is_valid():
            entity = form.save(commit=False)
            entity.put()
            success = True
    else:
        form = PortfolioForm(instance=portfolio)

    data = {"form": form, "portfolio": portfolio, "success": success}

    return render_to_response("portfolios/update.html", data, context_instance=RequestContext(request))