예제 #1
0
def create_profile(user, gender=None, lname=None):

    if gender is None:
        gender = get_random_gender()

    fname = get_random_fname(gender)

    if lname is None:
        lname = get_random_lname()

    zc = get_random_zip()
    photo = adult_photo(gender)

    profile = Profile()
    profile.user = user
    profile.first_name = fname
    profile.last_name = lname
    profile.zip_code = zc
    profile.gender = gender

    profile.save()

    f = open(photo, 'r')
    np = Photo(album=profile.album, caption="Profile", original_image=File(f))
    np.save()

    profile.set_profile_pic(np)

    return profile
예제 #2
0
파일: fake.py 프로젝트: braskin/pd
def create_profile(user, gender=None, lname=None):

    if gender is None:
        gender = get_random_gender()


    fname = get_random_fname(gender)

    if lname is None:
        lname = get_random_lname()

    zc = get_random_zip()
    photo = adult_photo(gender)

    profile = Profile()        
    profile.user = user
    profile.first_name = fname
    profile.last_name = lname
    profile.zip_code = zc
    profile.gender = gender

    profile.save()

    f = open(photo, 'r')
    np = Photo(album=profile.album, caption="Profile", original_image=File(f))
    np.save()

    profile.set_profile_pic(np)

    return profile 
예제 #3
0
파일: forms.py 프로젝트: fmaj7/mymd
    def create_profile(self, user, commit=True):
        community = Community.objects.get(pk=self.cleaned_data["community"])
        disease = Disease.objects.get(pk=self.cleaned_data["disease"].id)
        gender = self.cleaned_data["gender"]

        profile = Profile()
        profile.disease = disease
        profile.community = community
        profile.gender = gender
        profile.birth_date = self.cleaned_data["birth_date"]

        profile.user = user
        if commit:
            profile.save()
        return profile
예제 #4
0
파일: forms.py 프로젝트: braskin/pd
 def create_profile(self, user=None, profile_data=None, commit=True):
     profile = Profile()
     if user is None:
         raise NotImplementedError("SignupForm.create_profile requires a valid user")
         
     profile.user = user
     profile.first_name = profile_data["first_name"]
     profile.last_name = profile_data["last_name"]
     profile.zip_code = profile_data["zip_code"]
     profile.gender = profile_data["gender"]
     profile.source = profile_data["source"]
     
     profile.save()
     
     return profile 
예제 #5
0
파일: forms.py 프로젝트: bopopescu/pd
    def create_profile(self, user=None, profile_data=None, commit=True):
        profile = Profile()
        if user is None:
            raise NotImplementedError(
                "SignupForm.create_profile requires a valid user")

        profile.user = user
        profile.first_name = profile_data["first_name"]
        profile.last_name = profile_data["last_name"]
        profile.zip_code = profile_data["zip_code"]
        profile.gender = profile_data["gender"]
        profile.source = profile_data["source"]

        profile.save()

        return profile
예제 #6
0
파일: views.py 프로젝트: braskin/pd
def create_profile(user, profile_data, commit=True):
    profile = Profile()
    if user is None:
        raise NotImplementedError("SignupForm.create_profile requires a valid user")

    profile.user = user
    profile.first_name = profile_data["first_name"]
    profile.last_name = profile_data["last_name"]
    profile.fb_account_linked = profile_data["fb_account_linked"]
    profile.fb_id = profile_data["fb_id"]
    profile.fb_stream_publish = profile_data["fb_stream_publish"]
    profile.source = profile_data["source"]
    profile.gender = profile_data["gender"]
    profile.fb_login = profile_data["fb_login"]
    profile.zip_code = profile_data["zip_code"]

    profile.save()

    return profile
예제 #7
0
def create_profile(user, profile_data, commit=True):
    profile = Profile()
    if user is None:
        raise NotImplementedError(
            "SignupForm.create_profile requires a valid user")

    profile.user = user
    profile.first_name = profile_data["first_name"]
    profile.last_name = profile_data["last_name"]
    profile.fb_account_linked = profile_data["fb_account_linked"]
    profile.fb_id = profile_data["fb_id"]
    profile.fb_stream_publish = profile_data["fb_stream_publish"]
    profile.source = profile_data["source"]
    profile.gender = profile_data["gender"]
    profile.fb_login = profile_data["fb_login"]
    profile.zip_code = profile_data["zip_code"]

    profile.save()

    return profile