def get_context_data(self, request, profile):
        details = serialize_profilefields_data(request, profilefields, profile)

        request.frontend_context['PROFILE_DETAILS'] = details

        return {
            'profile_details': details,
        }
Example #2
0
    def get_context_data(self, request, profile):
        details = serialize_profilefields_data(request, profilefields, profile)

        request.frontend_context['PROFILE_DETAILS'] = details

        return {
            'profile_details': details,
        }
def submit_form(request, user):
    fields = []
    for field in profilefields.get_fields():
        if field.is_editable(request, user):
            fields.append(field)

    form = DetailsForm(
        request.data,
        request=request,
        user=user,
    )

    if form.is_valid():
        profilefields.update_user_profile_fields(request, user, form)
        user.save(update_fields=['profile_fields'])

        return Response(serialize_profilefields_data(request, profilefields, user))

    return Response(form.errors, status=400)
def submit_form(request, user):
    fields = []
    for field in profilefields.get_fields():
        if field.is_editable(request, user):
            fields.append(field)

    form = DetailsForm(
        request.data,
        request=request,
        user=user,
    )

    if form.is_valid():
        profilefields.update_user_profile_fields(request, user, form)
        user.save(update_fields=['profile_fields'])

        return Response(serialize_profilefields_data(request, profilefields, user))

    return Response(form.errors, status=400)
Example #5
0
 def details(self, request, pk=None):
     profile = self.get_user(request, pk)
     data = serialize_profilefields_data(request, profilefields, profile)
     return Response(data)
 def details(self, request, pk=None):
     profile = self.get_user(request, pk)
     data = serialize_profilefields_data(request, profilefields, profile)
     return Response(data)