Here the model
class Abones(models.Model):
idu = models.IntegerField(db_column='idU') # Field name made lowercase.
nom = models.TextField()
prenom = models.TextField()
nom_pere = models.TextField()
nom_mere = models.TextField()
sexe = models.TextField()
nationalite = models.TextField()
date_naissance = models.TextField()
identite = models.CharField(max_length=250)
province_n = models.TextField()
commune_n = models.TextField()
zone_n = models.TextField()
colline_n = models.TextField()
residence = models.TextField()
occupation = models.TextField(blank=True, null=True)
recto = models.TextField()
verso = models.TextField()
photo = models.TextField()
date = models.TextField()
class Meta:
managed = False
db_table = 'abones'
This is the traceback:
Internal Server Error: /api/v1/subscribers-list
Traceback (most recent call last):
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/var/www/envs/onasoft/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/rest_framework/generics.py", line 199, in get
return self.list(request, *args, **kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/rest_framework/mixins.py", line 38, in list
queryset = self.filter_queryset(self.get_queryset())
File "/var/www/test/onasoft_test/onasoftadapter/apps/base/views.py", line 106, in get_queryset
queryset = queryset.filter(date_as_datetime=start_date)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/query.py", line 1436, in filter
return self._filter_or_exclude(False, args, kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/query.py", line 1454, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, args, kwargs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/query.py", line 1461, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1534, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1565, in _add_q
child_clause, needed_inner = self.build_filter(
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1433, in build_filter
condition = self.build_lookup(lookups, reffed_expression, value)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1307, in build_lookup
lookup = lookup_class(lhs, rhs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/lookups.py", line 27, in __init__
self.rhs = self.get_prep_lookup()
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/lookups.py", line 341, in get_prep_lookup
return super().get_prep_lookup()
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/lookups.py", line 85, in get_prep_lookup
return self.lhs.output_field.get_prep_value(self.rhs)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 1585, in get_prep_value
value = super().get_prep_value(value)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 1464, in get_prep_value
return self.to_python(value)
File "/var/www/envs/onasoft/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 1538, in to_python
% (self.model.__name__, self.name, value),
AttributeError: 'DateTimeField' object has no attribute 'model'