'Post-generation handler.
Sets up parameters field.'

@factory.post_generation
def post(obj, create, extracted, **kwargs):

    if (not obj.parameters):
        course_key = obj.course.course_key
        user = User.objects.get(username=obj.username)
        user_profile = user.profile
        obj.parameters = json.dumps({'request_uuid': obj.uuid, 'timestamp': to_timestamp(datetime.datetime.now(pytz.UTC)), 'course_org': course_key.org, 'course_num': course_key.course, 'course_run': course_key.run, 'final_grade': '0.96', 'user_username': user.username, 'user_email': user.email, 'user_full_name': user_profile.name, 'user_mailing_address': '', 'user_country': (user_profile.country.code or '')})
    obj.save()
