def check_profile(self, user, request):
     phone_number = request.data.get("phone_number")
     profile = None
     try:
         profile = Profile.objects.get(user=user)
     except Exception as e:
         profile = Profile(user=user)
     if phone_number:
         profile.phone_number = phone_number
     profile.save()
Ejemplo n.º 2
0
def random_profile(user, prob=0.33):
    """
    Create random profile for user.
    """

    items = RANDOM_PROFILE_FIELDS.items()
    fields = {k: v() for k, v in items if random() <= prob}
    return Profile(user_id=user.id, **fields)
Ejemplo n.º 3
0
 def profile(self):
     return Profile(
         user=User(username='******', name='name'),
         image='image',
         age=18,
         country='country',
         city='city',
         state='state',
         biography='biography',
         occupation='occupation',
         gender=Gender.FEMALE,
         political_activity='political_activity',
         race=Race.INDIGENOUS,
     )
Ejemplo n.º 4
0
 def profile(self):
     return Profile(
         user=User(email="*****@*****.**", name="name"),
         profile_photo="profile_photo",
         birth_date=date(1996, 1, 17),
         country="country",
         city="city",
         state="state",
         biography="biography",
         occupation="occupation",
         gender=Gender.FEMALE,
         political_activity="political_activity",
         race=Race.INDIGENOUS,
         ethnicity="ethnicity",
         education="undergraduate",
     )
Ejemplo n.º 5
0
 def profile(self):
     return Profile(
         user=User(email='*****@*****.**', name='name'),
         profile_photo='profile_photo',
         birth_date=date(1996, 1, 17),
         country='country',
         city='city',
         state='state',
         biography='biography',
         occupation='occupation',
         gender=Gender.FEMALE,
         political_activity='political_activity',
         race=Race.INDIGENOUS,
         ethnicity="ethnicity",
         education="undergraduate",
     )