Closed yogeshchandrark closed 11 months ago
There's some problem with your models...
Labroom_SpaceUtilisation
— I'd try following Python/Django's naming conventions to begin: LabroomSpaceUtilisation
and tp_name
, program
etc.
Comment out the FilterSet
and try loading your models in the Admin first.
This isn't really a Django-Filter issue, sorry. Good luck.
Hi all,
i have below configs in my virtual env running on my Ubuntu 22.04 server
Django==4.2.5 Python==3.11.5 django-filter==23.3
settings.py
'DEFAULT_FILTER_BACKENDS': [ 'django_filters.rest_framework.DjangoFilterBackend', ],
models.py
class Labroom_SpaceUtilisation(models.Model): Tpname = models.CharField(max_length=150, unique=False, null=True, blank=True) Program = models.CharField(max_length=150, unique=False, null=True, blank=True) Labroom = models.CharField(max_length=150, unique=False, null=True, blank=True) FreeSpace = models.CharField(max_length=150, unique=False, null=True, blank=True) TotalSpace = models.CharField(max_length=150, unique=False, null=True, blank=True)
filters.py
from django_filters import rest_framework as filters from django_filters import FilterSet from .models import Labroom_SpaceUtilisation
class LabroomFilters(FilterSet): Tpname = filters.CharFilter('Tpname') Program = filters.CharFilter('Program') Labroom = filters.CharFilter('Labroom')
when i run the server i get the below error
AttributeError: type object 'Labroom_SpaceUtilisation' has no attribute '_meta'
what is the issue, is it issue with the version i have isntalled (compatibility issue ?)
Please help me with this