Ejemplo n.º 1
0
def signedUp(request):
    username = request.GET['username']
    email = request.GET['email']
    password = request.GET['password']
    university = request.GET['university']
    skills = request.GET['skills']
    user = User.objects.create_user(username, email, password)
    person = Person(user=user, skills=skills, university=university)
    person.save()
    return render(request, 'projects/signedUp.html', {
        'username': username,
        'email': email
    })
Ejemplo n.º 2
0
def load_db():
    sys.path.append("../data")
    from international_projects import projects
    int_faculty = set()
    p_fac = set()
    book = country_codes()

    # add countries
    for c in book:
        country = Country()
        country.name = c
        country.country_id = book[c]
        print 'created', country
        country.save()
        print 'saved', country

    for p in projects:
        project = Project()
        project.title = p['title']
        print p['title']
        #print project
        if 'description' in p:
            project.description = p['description']
        print "    added description"
        if 'partners' in p:
            project.partners = p['partners']
        project.save()
        print "    saving"
        print "    added partners"
        for f in p['faculty']:
            print "    creating/looking for", f
            try:
                person = Person.objects.get(full_name=f)
                print "    found", f
            except:
                person = Person()
                person.full_name = f
                person.save()
                print "    created", f

            project.people.add(person)
        for c in p['countries']:
            country = Country.objects.get(name=c)
            project.countries.add(country)

        project.save()
    # load things from graph
    for name, node in g.nodes(data=True):
        pass
Ejemplo n.º 3
0
def EditPerson(request):
    person = Person()
    form = PersonForm()

    if request.method == 'POST':
        form = PersonForm(request.POST)

        if form.is_valid():
            person.user = request.user
            person.username = request.POST.get('username')
            person.mail = request.POST.get('usermail')

            person.save()

            return render_to_response('projects/list_projects.html',
                                      context_instance=RequestContext(request))

        else:
            context = {'form': form}

        return render_to_response('projects/editPerson.html',
                                  context,
                                  context_instance=RequestContext(request))

    context = {'form': form}

    return render_to_response('projects/editPerson.html',
                              context,
                              context_instance=RequestContext(request))
Ejemplo n.º 4
0
def EditPerson(request):
    person = Person()
    form = PersonForm()

    if request.method == 'POST':
        form = PersonForm(request.POST)

        if form.is_valid():
            person.user = request.user
            person.username = request.POST.get('username')
            person.mail = request.POST.get('usermail')

            person.save()

            return render_to_response('projects/list_projects.html', context_instance=RequestContext(request))

        else:
            context = {'form': form}

        return render_to_response('projects/editPerson.html', context, context_instance=RequestContext(request))

    context = {'form': form}

    return render_to_response('projects/editPerson.html', context, context_instance=RequestContext(request))