Ejemplo n.º 1
0
def personalProfile(request):
    print(request.POST)
    currentProfile = request.user
    if request.method == 'POST':
        form = ProfileForm(request.POST, request.FILES)
        if form.is_valid():
            year = form.cleaned_data.get('year')
            major = form.cleaned_data.get('major')
            gender = form.cleaned_data.get('gender')
            sexualOrientation = form.cleaned_data.get('sexualOrientation')
            bio = form.cleaned_data.get('bio')
            idealDate = form.cleaned_data.get('idealDate')
            kagin = form.cleaned_data.get('kagin')
            cafemac = form.cleaned_data.get('cafemac')
            athletes = form.cleaned_data.get('athletes')
            cold = form.cleaned_data.get('cold')
            lookingFor = form.cleaned_data.get('lookingFor')
            friendLookingFor = form.cleaned_data.get('friendLookingFor')
            politics = form.cleaned_data.get('politics')
            aesthetics = form.cleaned_data.get('aesthetics')
            nap = form.cleaned_data.get('nap')
            saturday = form.cleaned_data.get('saturday')
            appSampler = form.cleaned_data.get('appSampler')
            pic = request.FILES['pic']
            total = idealDate+kagin+cafemac+athletes+cold+lookingFor+friendLookingFor+politics+aesthetics+nap+saturday+appSampler
            score = float(total)/12.0
            Profile.objects.create(user=currentProfile,year=year,major=major,gender=gender,sexualOrientation=sexualOrientation,bio=bio,idealDate=idealDate,kagin=kagin,cafemac=cafemac,athletes=athletes,cold=cold,lookingFor=lookingFor,friendLookingFor=friendLookingFor,politics=politics,aesthetics=aesthetics,nap=nap,appSampler=appSampler,saturday=saturday,score=score,pic=pic)
            return redirect('home')
    else:
        form = ProfileForm()
    return render(request, 'smack/personProfile.html',{'form':form})
Ejemplo n.º 2
0
def editProfile(request):
    profile = Profile.objects.get(user=request.user)
    if request.method == 'POST':
        form = ProfileForm(request.POST, request.FILES)
        if form.is_valid():
            profile.year = form.cleaned_data.get('year')
            profile.major = form.cleaned_data.get('major')
            profile.gender = form.cleaned_data.get('gender')
            profile.sexualOrientation = form.cleaned_data.get('sexualOrientation')
            profile.bio = form.cleaned_data.get('bio')
            profile.idealDate = form.cleaned_data.get('idealDate')
            profile.kagin = form.cleaned_data.get('kagin')
            profile.cafemac = form.cleaned_data.get('cafemac')
            profile.athletes = form.cleaned_data.get('athletes')
            profile.cold = form.cleaned_data.get('cold')
            profile.lookingFor = form.cleaned_data.get('lookingFor')
            profile.friendLookingFor = form.cleaned_data.get('friendLookingFor')
            profile.politics = form.cleaned_data.get('politics')
            profile.aesthetics = form.cleaned_data.get('aesthetics')
            profile.nap = form.cleaned_data.get('nap')
            profile.saturday = form.cleaned_data.get('saturday')
            profile.appSampler = form.cleaned_data.get('appSampler')
            pic = request.FILES['pic']
            total = idealDate+kagin+cafemac+athletes+cold+lookingFor+friendLookingFor+politics+aesthetics+nap+saturday+appSampler
            profile.score = float(total)/12.0
            profile.save()
            return redirect('home')
    else:
        data = {'year':profile.year,'major':profile.major,'gender':profile.gender,'sexualOrientation':profile.sexualOrientation,'bio':profile.bio,'email':profile.email,'idealDate':profile.idealDate,'kagin':profile.kagin,'cafemac':profile.cafemac,'athletes':profile.athletes,'cold':profile.cold,'lookingFor':profile.lookingFor}
        data1 = {'politics':profile.politics,'aesthetics':profile.aesthetics,'nap':profile.nap,'saturday':profile.saturday,'appSampler':profile.appSampler,'friendLookingFor':profile.friendLookingFor,'pic':profile.pic}
        data.update(data1)
        form = ProfileForm(initial=data)
    return render(request, 'smack/editProfile.html', {'form':form})
Ejemplo n.º 3
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 4
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 5
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     # https://cloud.google.com/appengine/docs/python/tools/protorpc/messages/messageclass#all_fields
     for field in pf.all_fields():
         if hasattr(prof, field.name):    
             setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 6
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 7
0
    def _copyProfileToForm(self, prof):

        pf = ProfileForm()
        for field in pf.all_fields():
            if hasattr(prof, field.name):
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
Ejemplo n.º 8
0
 def toProfileForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == "teeShirtSize":
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 9
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     pf = ProfileForm()
     # Loop through all fields and copy data to form
     for field in pf.all_fields():
         if hasattr(prof, field.name):
           
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 10
0
    def _copyProfileToForm(self, prof):

        pf = ProfileForm()
        for field in pf.all_fields():
            if hasattr(prof, field.name):
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name,
                            getattr(TeeShirtSize, getattr(prof, field.name)))
                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
Ejemplo n.º 11
0
 def registerUser(self, request):
     p_key = ndb.Key(UserDetails, request.phoneNumber)
     succ = 1
     user = UserDetails(
         key=p_key,
         displayName=request.displayName,
         mainEmail=request.mainEmail,
         balance=0,
         phoneNumber=request.phoneNumber,
         pin=request.pin,
         uri=request.uri,
     )
     try:
         user.put()
     except datastore_errors.DuplicatePropertyError:
         succ = 0
     prof = ProfileForm()
     if succ == 1:
         prof.displayName = user.displayName
         prof.uri = user.uri
         prof.mainEmail = user.mainEmail
         prof.balance = user.balance
         prof.phoneNumber = user.phoneNumber
     prof.success = succ
     return prof
Ejemplo n.º 12
0
 def _copyProfileToForm(self, prof):
     """ Copy relevant fields from Profile to ProfileForm. """
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == "teeShirtSize":
                 setattr(pf, field.name,
                         getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 13
0
    def _copyProfileToForm(self, prof):
        """Copy relevant fields from Profile to ProfileForm."""
        # copy relevant fields from Profile to ProfileForm
        pf = ProfileForm()
        for field in pf.all_fields():
            if hasattr(prof, field.name) and not field.name == 'conferenceKeysToAttend':
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))

                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     logging.debug("Did run _copyProfileToForm()")
     return pf
Ejemplo n.º 15
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             elif field.name == 'sessionWishlist':
                 setattr(pf, field.name, [k.urlsafe() for k in getattr(prof, field.name)])
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 16
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             elif (field.name == 'sessionKeysToAttend' or field.name == 'conferenceKeysToAttend'):
                 new_list = [item.get().key.urlsafe() for item in getattr(prof, field.name)]
                 setattr(pf, field.name, new_list)
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 17
0
def edit(request):
  user=users.GetCurrentUser()
  if user is None:
    return http.HttpResponseForbidden('You must be signed in to add or edit a greeting')
  profile=Profile.gql("where user=:1",user).get()
  form = ProfileForm(data=request.POST or None, instance=profile)

  if not request.POST:
    return views.respond(request, user, 'profiles/form', {'form': form, 'current_profile': profile})

  errors = form.errors
  if not errors:
    try:
      profile = form.save(commit=False)
    except ValueError, err:
      errors['__all__'] = unicode(err)
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     print pf
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             # getattr(object, name[, default]):Return the value of the named attr. or default
             # setattr(object, name, value)
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 19
0
 def _copyProfileToForm(self, profile):
     """Copy relevant fields from Profile to ProfileForm."""
     profileForm = ProfileForm()
     for field in profileForm.all_fields():
         if hasattr(profile, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr( profileForm,
                          field.name,
                          getattr(TeeShirtSize, getattr(profile, field.name)) )
             else:
                 setattr( profileForm,
                          field.name,
                          getattr(profile, field.name) )
     profileForm.check_initialized()
     return profileForm
Ejemplo n.º 20
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == "teeShirtSize":
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             if field.name == "websafeSessionKeysWishlist":
                 sessionKeysWishlist = getattr(prof, "sessionKeysWishlist")
                 websafeSessionKeysWishlist = [k.urlsafe() for k in websafeSessionKeysWishlist]
                 setattr(pf, field.name, websafeSessionKeysWishlist)
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 21
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(
                     TeeShirtSize, getattr(prof, field.name)))
             elif field.name == "sessionKeysWishlist":
                 all_keys = []
                 for each_key in prof.sessionKeysWishlist:
                     all_keys.append(each_key.urlsafe())
                 setattr(pf, field.name, all_keys)
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 22
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert key objects to websafekey, put it back in a list
             if field.name.endswith('Attend'):
                 key_list = [x.urlsafe() for x in getattr(prof, field.name)]
                 setattr(pf, field.name, key_list)
             # convert t-shirt string to Enum;
             elif field.name == 'teeShirtSize':
                 setattr(pf, field.name,
                         getattr(TeeShirtSize, getattr(prof, field.name)))
             # just copy others
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
Ejemplo n.º 23
0
def editProfile(request):
    title="Edit Profile"
    if request.method == 'POST':
        userform = ProfileForm(request.POST) # A form bound to the POST data
        adressform = AdressForm(request.POST)
        if userform.is_valid(): # All validation rules pass
            oldpassword = userform.cleaned_data['oldpassword']
            password = userform.cleaned_data['password']
            secpassword = userform.cleaned_data['secpassword']
            email = userform.cleaned_data['email']
            
        if adressform.is_valid():
            publicadress = adressform.cleaned_data['publicAdress']
            country = adressform.cleaned_data['country']
            city = adressform.cleaned_data['city']
            zipcode = adressform.cleaned_data['zipcode']
            street = adressform.cleaned_data['street']
            housenumber = adressform.cleaned_data['housenumber']
            userprofile = request.user.profile
            l = Location(country=country, city=city, zipcode=zipcode, street=street, housenumber=housenumber)
            l.save()
            userprofile.adress = l
            userprofile.publicAdress = publicadress
            userprofile.save()
    else:
        user = request.user
        try:
            userform = ProfileForm({'email': user.email,})
        except:
            userform = UserForm()
        try:
            adressform = AdressForm({
                                'publicAdress': user.profile.publicAdress,
                                'country': user.profile.adress.country,
                                'city': user.profile.adress.city, 
                                'zipcode': user.profile.adress.zipcode, 
                                'street': user.profile.adress.street, 
                                'housenumber': user.profile.adress.housenumber})
        except:
            adressform = AdressForm()
    context = util.generateContext(request, contextType = 'RequestContext', userform=userform, adressform=adressform, title=title)
    return render_to_response('usermanag/edit.html', context)
Ejemplo n.º 24
0
def profile():
    form = ProfileForm(request.form)
    profile_settings = Profile.query.get(int(current_user.get_id()))

    if request.method == 'POST' and form.validate():
        profile_settings.fullname = f'{form.firstName.data} {form.surname.data}'
        profile_settings.firstName = form.firstName.data
        profile_settings.surname = form.surname.data
        profile_settings.age = form.age.data
        profile_settings.twitter = form.twitter.data
        profile_settings.instagram = form.instagram.data
        profile_settings.city = form.city.data
        profile_settings.country = form.country.data
        profile_settings.aboutMe = form.aboutMe.data
        profile_settings.profileEdited = True

        db.session.commit()

        return redirect(url_for('profile'))

    if profile_settings.profileEdited:
        form.firstName.default = profile_settings.firstName
        form.surname.default = profile_settings.surname
        form.age.default = profile_settings.age
        form.twitter.default = profile_settings.twitter
        form.instagram.default = profile_settings.instagram
        form.city.default = profile_settings.city
        form.country.default = profile_settings.country
        form.aboutMe.default = profile_settings.aboutMe

        form.process()

        return render_template(
            'profile.html',
            form=form,
            fullname=profile_settings.fullname,
            city=profile_settings.city,
            aboutMe=profile_settings.aboutMe,
            age=profile_settings.age,
            instagram=f'https://www.instagram.com/{profile_settings.instagram}',
            twitter=f'https://www.twitter.com/{profile_settings.twitter}')

    else:
        form.firstName.default = profile_settings.firstName
        form.surname.default = profile_settings.surname
        form.city.default = profile_settings.city
        form.country.default = profile_settings.country
        form.process()

        return render_template(
            'profile.html',
            form=form,
            fullname=profile_settings.fullname,
            city=profile_settings.city,
            aboutMe=profile_settings.aboutMe,
            age=profile_settings.age,
        )
Ejemplo n.º 25
0
    def _copyProfileToForm(self, prof):
        """Copy relevant fields from Profile to ProfileForm."""
        # copy relevant fields from Profile to ProfileForm
        pf = ProfileForm()

        for field in pf.all_fields():
            if hasattr(prof, field.name):
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name,
                            getattr(TeeShirtSize, getattr(prof, field.name)))
                elif field.name == 'conferenceKeysToAttend':
                    setattr(pf, field.name, [conf.urlsafe() for conf \
                        in prof.conferenceKeysToAttend])
                elif field.name == 'sessionKeysToAttend':
                    setattr(pf, field.name, [sess.urlsafe() for sess \
                        in prof.sessionKeysToAttend])
                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
Ejemplo n.º 26
0
def profile():
    '''
    Profile
    '''
    form = ProfileForm()
    if request.method == 'POST' and form.validate_on_submit():
        if form.last_name.data:
            current_user.last_name = form.last_name.data
        if form.first_name.data:
            current_user.first_name = form.first_name.data
        if form.phone:
            current_user.phone = form.phone.data
        if form.email:
            current_user.email = form.email.data
        DB.session.commit()
        return redirect(url_for('index'))
    else:
        form.email.data = current_user.email
        form.first_name.data = current_user.first_name
        form.last_name.data = current_user.last_name
        form.phone.data = current_user.phone
    return render_template('profile.html', form=form)
Ejemplo n.º 27
0
 def googleLoginUser(self, request):
     qry = UserDetails.GoogleLogin(request.mainEmail, request.uri)
     succ = 1
     user = qry.get()
     prof = ProfileForm()
     if user is None:
         succ = 0
     elif succ == 1:
         prof.displayName = user.displayName
         prof.mainEmail = user.mainEmail
         prof.phoneNumber = user.phoneNumber
         prof.balance = user.balance
         prof.uri = user.uri
     prof.success = succ
     return prof
Ejemplo n.º 28
0
 def loginUser(self, request):
     p_key = ndb.Key(UserDetails, request.phoneNumber)
     user = p_key.get()
     succ = 1
     if user is None:
         succ = 0
     elif user.pin != request.pin:
         succ = 2
     prof = ProfileForm()
     if succ == 1:
         prof.displayName = user.displayName
         prof.mainEmail = user.mainEmail
         prof.phoneNumber = user.phoneNumber
         prof.balance = user.balance
         prof.uri = user.uri
     prof.success = succ
     return prof
Ejemplo n.º 29
0
def editProfileMethod(request):
    try:
        fields = ProfileForm.all_fields()
        profileId = ndb.Key(urlsafe=getattr(request, 'profileId'))
        profile = profileId.get()
        for field in fields:
            value = getattr(request, field.name, None)
            if field.name == 'collegeId':
                continue
            if value is None or value == "" or value == []:
                continue
            setattr(profile, field.name, value)
        profile.put()
        return Response(response=0, description="OK")
    except Exception, E:
        return Response(response=1, description=str(E))
Ejemplo n.º 30
0
def personalProfile(request):
    print(request.POST)
    currentProfile = request.user
    if request.method == 'POST':
        form = ProfileForm(request.POST, request.FILES)
        if form.is_valid():
            full_name = form.cleaned_data.get('full_name')
            email = form.cleaned_data.get('email')
            year = form.cleaned_data.get('year')
            major = form.cleaned_data.get('major')
            gender = form.cleaned_data.get('gender')
            sexualOrientation = form.cleaned_data.get('sexualOrientation')
            bio = form.cleaned_data.get('bio')
            idealDate = form.cleaned_data.get('idealDate')
            kagin = form.cleaned_data.get('kagin')
            cafemac = form.cleaned_data.get('cafemac')
            athletes = form.cleaned_data.get('athletes')
            cold = form.cleaned_data.get('cold')
            lookingFor = form.cleaned_data.get('lookingFor')
            friendLookingFor = form.cleaned_data.get('friendLookingFor')
            politics = form.cleaned_data.get('politics')
            aesthetics = form.cleaned_data.get('aesthetics')
            nap = form.cleaned_data.get('nap')
            saturday = form.cleaned_data.get('saturday')
            appSampler = form.cleaned_data.get('appSampler')
            pic = request.FILES['pic']
            total = int(idealDate) + int(kagin) + int(cafemac) + int(
                athletes) + int(cold) + int(lookingFor) + int(
                    friendLookingFor) + int(politics) + int(aesthetics) + int(
                        nap) + int(saturday) + int(appSampler)
            score = int(total) / 12
            Profile.objects.create(full_name=full_name,
                                   email=email,
                                   user=currentProfile,
                                   year=year,
                                   major=major,
                                   gender=gender,
                                   sexualOrientation=sexualOrientation,
                                   bio=bio,
                                   idealDate=idealDate,
                                   kagin=kagin,
                                   cafemac=cafemac,
                                   athletes=athletes,
                                   cold=cold,
                                   lookingFor=lookingFor,
                                   friendLookingFor=friendLookingFor,
                                   politics=politics,
                                   aesthetics=aesthetics,
                                   nap=nap,
                                   appSampler=appSampler,
                                   saturday=saturday,
                                   score=score,
                                   pic=pic)
            if request.user.is_authenticated():
                user = request.user
            profile = Profile.objects.get(user=user)
            profile.dislike.add(profile)
            return redirect('home')
    else:
        form = ProfileForm()
    return render(request, 'smack/personProfile.html', {'form': form})