1

Pardon me but I am a bit new to Django,

Django does not even tell me the field having issues

I keep getting an error I don't understand

How do I know the field having issues?

When I try to fetch a user profile(Basically a get call) on this model, see the error I keep getting

I checked a lot of stack overflow posts but none seems to give me the information I need to resolve these errors on this get profile call

  File "/MyPath/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/MyPath/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/MyPath/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/MyPath/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/MyPath/app_features/views.py", line 36, in list
    return Response(serializer.data)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/serializers.py", line 745, in data
    ret = super().data
  File "/MyPath/lib/python3.8/site-packages/rest_framework/serializers.py", line 246, in data
    self._data = self.to_representation(self.instance)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/serializers.py", line 663, in to_representation
    return [
  File "/MyPath/lib/python3.8/site-packages/rest_framework/serializers.py", line 664, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/MyPath/lib/python3.8/site-packages/rest_framework/serializers.py", line 515, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/fields.py", line 1224, in to_representation
    value = self.enforce_timezone(value)
  File "/MyPath/lib/python3.8/site-packages/rest_framework/fields.py", line 1172, in enforce_timezone
    if timezone.is_aware(value):
  File "/MyPath/lib/python3.8/site-packages/django/utils/timezone.py", line 212, in is_aware
    return value.utcoffset() is not None
AttributeError: 'datetime.date' object has no attribute 'utcoffset'

see my model

class UserProfile(AbstractUser):
    image_id = models.CharField(max_length=200)
    date_created = models.DateTimeField(auto_now_add=True, null=True)
    is_recurring = models.BooleanField(default=False)
    email_verified_at = models.CharField(max_length=200)
    first_name = models.CharField(max_length=200)
    last_name = models.CharField(max_length=200)
    fullname = models.CharField(max_length=200)
    phone_number = models.CharField(max_length=14)
    profile_type = models.CharField(max_length=200)
    balance = models.CharField(max_length=200)
    tenant_id = models.CharField(max_length=200)
    promo_code = models.CharField(max_length=200)
    formatted_date = models.CharField(max_length=200)
    account_number = models.CharField(max_length=10)
    father_name = models.CharField(max_length=200)
    status = models.CharField(max_length=200)
    address = models.CharField(max_length=200)
    dob = models.CharField(max_length=200)
    city = models.CharField(max_length=200)
    gender = models.CharField(max_length=200)
    rating = models.CharField(max_length=200)
    state = models.CharField(max_length=200)
    country = models.CharField(max_length=200)
    delete_flag = models.BooleanField(default=False)
    last_logged_in = models.DateTimeField(auto_now=True, null=True)
    last_modified = models.DateTimeField(auto_now=True, null=True)
    bvn = models.CharField(max_length=14)
    pin = models.CharField(max_length=14)
    question_1 = models.CharField(max_length=200)
    question_2 = models.CharField(max_length=200)
    question_3 = models.CharField(max_length=200)
    answer_1 = models.CharField(max_length=200)
    answer_2 = models.CharField(max_length=200)
    answer_3 = models.CharField(max_length=200)
    docType = models.CharField(max_length=200)
    docTypeURL = models.ImageField(upload_to='pictures/%Y/%m/%d/', max_length=255, null=True, blank=True)
    last_login = models.DateTimeField(auto_now_add=True)
    date_joined = models.DateTimeField(null=True)
    is_superuser = models.BooleanField(default=False)
    is_staff = models.BooleanField(default=False)
    is_active = models.BooleanField(default=False)
    username = models.CharField(max_length=200, unique=True)
    countryCode = models.CharField(max_length=200)
    receive_notifications = models.BooleanField(default=True)
    date_of_birth = models.CharField(max_length=200)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.