diff --git a/djadmin2/admin2.py b/djadmin2/admin2.py index 5cfece8a..abbba0a0 100644 --- a/djadmin2/admin2.py +++ b/djadmin2/admin2.py @@ -17,6 +17,7 @@ class GroupSerializer(Admin2APISerializer): class Meta: model = Group + fields = '__all__' class GroupAdmin2(ModelAdmin2): diff --git a/djadmin2/apiviews.py b/djadmin2/apiviews.py index e126f5fb..24d5cf16 100644 --- a/djadmin2/apiviews.py +++ b/djadmin2/apiviews.py @@ -56,6 +56,7 @@ class ModelAPISerilizer(Admin2APISerializer): class Meta: model = model_class + fields = '__all__' return ModelAPISerilizer return super(Admin2APIMixin, self).get_serializer_class() diff --git a/djadmin2/filters.py b/djadmin2/filters.py index 557b2f7d..32d817d0 100644 --- a/djadmin2/filters.py +++ b/djadmin2/filters.py @@ -102,17 +102,22 @@ def build_date_filter(request, model_admin, queryset, field_name="published_date filterset_dict = { "year": NumericDateFilter( name=field_name, - lookup_type="year", + lookup_expr="year", ), "month": NumericDateFilter( name=field_name, - lookup_type="month", + lookup_expr="month", ), "day": NumericDateFilter( name=field_name, - lookup_type="day", + lookup_expr="day", ) } + filterset_dict["Meta"] = type( + type_str('Meta'), + (object, ), + {"model": queryset.model, "fields": [field_name]}, + ) return type( type_str('%sDateFilterSet' % queryset.model.__name__), diff --git a/djadmin2/types.py b/djadmin2/types.py index d3a366d1..fc494e97 100644 --- a/djadmin2/types.py +++ b/djadmin2/types.py @@ -285,6 +285,7 @@ class Admin2Inline(extra_views.InlineFormSet): adds some useful functionality. """ template = None + fields = '__all__' def construct_formset(self): """ diff --git a/example/db.sqlite3 b/example/db.sqlite3 index af9b94d7..ab10c5db 100644 Binary files a/example/db.sqlite3 and b/example/db.sqlite3 differ diff --git a/example/polls/admin2.py b/example/polls/admin2.py index ab94abba..7c632fee 100644 --- a/example/polls/admin2.py +++ b/example/polls/admin2.py @@ -8,6 +8,7 @@ class ChoiceInline(Admin2TabularInline): model = Choice + fields = '__all__' extra = 3 diff --git a/setup.py b/setup.py index f74ee11d..15b11427 100644 --- a/setup.py +++ b/setup.py @@ -128,10 +128,10 @@ def run_tests(self): #test_suite='runtests.runtests', install_requires=[ 'django>=1.8.0', - 'django-extra-views<=0.7.1', + 'django-extra-views==0.8.0', 'django-braces>=1.3.0', - 'djangorestframework<=3.3.3', - 'django-filter>=0.15.3', + 'djangorestframework<=3.5.3', + 'django-filter==1.0.0', 'pytz==2016.4', 'future>=0.15.2', ],